Function - Copies a string to a binary frame
FRAME :
USINT Destination buffer - must be an array
DST : STRING Source variable to be copied
POS :
DINT Position in the source buffer
MAXLEN :
DINT Specifies a fixed
length string
EOS :
BOOL Specifies a null terminated string
HEAD :
BOOL Specifies a string headed with its length
NEXTPOS : DINT Position in the destination buffer after the copied
data
0 in case or error (invalid position /
buffer size)
This function is commonly used for storing data to a communication frame.
In LD language, the operation is executed only if the input rung (EN) is TRUE. The output rung (ENO) keeps the same value as the input rung. This function is not available in IL language.
The FRAME input must fit the input position and data size. If the value cannot be safely copied, the function returns 0.
The function copies the following bytes to the frame:
MAXLEN | EOS | HEAD | description |
<> 0 | any | any | The string is stored on a fixed length specified by MAXLEN. If the string is actually smaller, the space is completed with null bytes. If the string is longer, it is truncated. |
= 0 | TRUE | any | The string is stored with its actual length and terminated by anull byte. |
= 0 | FALSE | TRUE | The string is stored with its actual length and preceded by its length stored on one byte |
=0 | FALSE | FALSE | invalid call |
The function returns the position in the source frame, after the stored data. Thus the return value can be used as a position for the next serialization.
Q := SerPutString (FRAME, DSR, POS, MAXLEN, EOS, HEAD);
(* The function is executed only if EN is
TRUE *)
(* ENO keeps the same value as EN *)
Not available