|Top Previous Next|
A STRUCT_BLOCK is a user-defined composite type. Struct blocks are an extremely useful facility to group variables as in this example:
The biggest advantage of the STRUCT_BLOCK is found when writing data of different types to the serial port, PDU message, or file system.
Instead of writing the data types individually, they can be grouped in a STRUCT_BLOCK, and the device sees it as one variable.
To access the members of a STRUCT_BLOCK, the same syntax as used with a FUNCTION_BLOCK is used.
gpsData.speed := 100;
To send the data through a serial channel:
serSendData(port:=1, data:=ADDR(gpsData), size:=SIZEOF(gpsData));