SerializeOut

PLCopen motion icon

 FunctionClosed A function calculates a result according to the current value of its inputs. A function has no internal data and is not linked to declared instances. - Copy the value of a variable to a binary frame.

Inputs

Input

Data Type

Range

Unit

Default

Description

BIGENDIAN

(missing or bad snippet)

TRUE, FALSE

 

 

TRUE if the frame is encoded with Big Endian format.

DATA

ANY(*)

N/A

N/A

No default

Source variable to be copied.

EN

(missing or bad snippet)

0, 1

N/A

No default

Execute the function.

FRAME

USINT

0,+65535

N/A

N/A

Destination buffer - must be an array.

POS

(missing or bad snippet)

0,+65535

N/A

N/A

Position in the destination buffer.

(*) DATA cannot be a STRING.

Outputs

Output

Data Type

Range

Unit

Description

NEXTPOS

DINT

 

N/A

  • Position in the destination buffer after the copied data.
  • 0 (zero) in case or error (e.g., invalid position or buffer size).

OK

BOOL

 

N/A

Returns true when the function successfully executes.

See Function - General Rules.

Remarks

This function is used for building a communication frame in binary format.

  • The FRAME input must be an array large enough to receive the data.
    • If the data cannot be safely copied to the destination buffer, the function returns 0 (zero).
  • This function cannot be used to serialize STRING variables.
  • The function returns the position in the destination frame, after the copied data.
    • The return value can be used as a position for the next serialization.

This function copies these number of bytes to the destination frame:

Bytes Description

1 byte

BOOL, BYTE, SINT, and USINT variables.

2 bytes

INT, UINT, and WORD variables.

4 bytes

DINT, DWORD, REAL, and UDINT variables.

8 bytes

LINT and LREAL variables.

FBD Language

FFLD Language

  • In the FFLD 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.

IL Language

Not available.

ST Language

Q := SERIALIZEOUT (FRAME, DATA, POS, BIGENDIAN);

See Also

SerializeIn