Function - Copies a string to a binary frame

Inputs

Input

Data type

Description

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.

Outputs

Output

Data type

Description

NEXTPOS

DINT

Position in the destination buffer after the copied data.
0 in case or error (invalid position / buffer size)

Remarks

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.

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.

ST Language

Q := SerPutString (FRAME, DSR, POS, MAXLEN, EOS, HEAD);

FBD Language

Fixed_Image

LD Language

The function is executed only if EN is TRUE.
ENO keeps the same value as EN.

Fixed_Image


Created with the Personal Edition of HelpNDoc: Make Help Documentation a Breeze with a Help Authoring Tool