
L-INX/L-GATE User Manual
96
LOYTEC
LOYTEC electronics GmbH
ASCII protocol: The serial communication block works with strings that are transmitted
and received.
Line-Oriented: Each command and reply is modeled as a text line. The line can be
terminated by any combination of CR and LF.
Start/End Character: If not line-oriented, a start and end character can be specified to
detect start and end of a frame. The end character must be escaped in the frame content.
Master/Slave: The serial communication block is a master, which sends requests over
the serial port and expects slave(s) to respond. The serial communication block can also
implement a slave, which receives requests and creates responses.
Addressing Information: If the serial protocol has more than one slave, each request must
have address information, which selects a specific slave. Especially for RS-485 bus
communication address information is required. Since frames sent out are also received,
they need to be filtered out by address.
To start the implementation of a custom serial protocol use the function block
SerialComm
located in the StandardLibs
Loytec_Support
Service folder. Add a bus number and
communication settings as a string (e.g., „38400-8N1-X“) as shown in Figure 80. Best
practice for an implementation is to use an SFC-based state machine. All necessary input and
output signals are available on this function block. The minimum number of states is Idle,
Rx, Tx. For a full specification of this block use the F1 help.
Figure 80: Example for the SerialComm block.
String processing may build commands from data point values and extract data from
responses, which are written to data points. The data points should be user registers that are
organized into a separate sub-folder for the custom serial protocol.