SerializeIn
Description
Extract the value of a variable from a binary frame. This function is commonly used for extracting data from a communication frame in binary format.
In LD"Ladder diagram" Ladder logic is a method of drawing electrical logic schematics. It is now a very popular graphical language for programming Programmable Logic Controllers (PLCs). It was originally invented to describe logic made from relays. The name is based on the observation that programs in this language resemble ladders, with two vertical "rails" and a series of horizontal "rungs" between them 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"Instruction list" This is a low-level language and resembles assembly language.
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 | BOOL, SINT, USINT and BYTE variables |
2 bytes | INT, UINT and WORD variables |
4 bytes | DINT, UDINT, DWORD and REAL variables |
8 bytes | 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
Arguments
Input
En | Description | Execute the function |
Data type | BOOL | |
Range | [0,1] | |
Unit | n/a | |
Default | — | |
FrameIn networking dialect, a message is called a frame[] | Description | Source buffer - must be an array. |
Data type | USINT | |
Range | [0,+65535] | |
Unit | n/a | |
Default | n/a | |
Data | Description | Destination variable to be copied |
Data type | any except STRING | |
Range | — | |
Unit | n/a | |
Default | — | |
Pos | Description | Position in the source buffer |
Data type | DINT | |
Range | [0,+65535] | |
Unit | n/a | |
Default | n/a | |
BigEndian | Description | TRUE if the frame is encoded with Big Endian format. |
Data type | BOOL | |
Range | ? | |
Unit | ? | |
Default | ? |
Output
OK | Description | Returns true when the function successfully executes. See Function - General rules. |
Data type | BOOL | |
Unit | n/a | |
NextPos | Description | Position in the source buffer after the extracted data.
0 in case or error (invalid position / buffer size).
|
Data type | DINT | |
Unit | n/a |
Examples
Structured Text
NextPos := SerializeIn(Frame[](*USINT*), @Data(*ANY*), Pos(*DINT*), BigEndian(*BOOL*)); //Read the position