SerializeIn
Function - Extract the value of a variable from a binary frame.
Inputs
Input |
Data type |
Description |
FRAME |
USINT |
Source buffer - must be an array. |
DATA |
ANY(*) |
Destination variable to be copied. |
POS |
DINT |
Position in the source buffer. |
BIGENDIAN |
BOOL |
TRUE if the frame is encoded with Big Endian format. |
(*) DATA cannot be a STRING.
Outputs
Output |
Data type |
Description |
NEXTPOS |
DINT |
Position in the source buffer after the extracted data. |
Remarks
This function is commonly used for extracting data from a communication frame in binary format.
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 extracted, the function returns 0.
The DATA input must be directly connected to a variable, and cannot be a constant or complex expression. This variable will be forced with the extracted value.
The function extracts the following number of bytes from the source frame:
1 byte for BOOL, SINT, USINT and BYTE variables
2 bytes for INT, UINT and WORD variables
4 bytes for DINT, UDINT, DWORD and REAL variables
8 bytes for LINT and LREAL variables
The function cannot be used to serialize STRING variables.
The function returns the position in the source frame, after the extracted data. Thus the return value can be used as a position for the next serialization.
ST Language
Q := SERIALIZEIN (FRAME, DATA, POS, BIGENDIAN);
FBD Language
LD Language
The function is executed only if EN is TRUE.
ENO keeps the same value as EN.
I
|
SerializeIn |
IEC 61131-3 Automation platform > Programming - Reference guide > Advanced operations > SerializeIn |
Created with the Personal Edition of HelpNDoc: Easily create CHM Help documents