Communication Principle

Background Communication

As described in the section on Supported Hardware, the maximum effective data transfer rate depends in part on the PLC cycle time. So, for example, for communication with the serial bus terminal at an effective rate of 9600 bps, a cycle time of 1 ms is required. In many larger applications such a short cycle time for the whole PLC would heavily load the control computer.

Since for most applications longer cycle times of, for instance, 10 ms are more than adequate, it is possible with the aid of this library to decouple the data traffic between the PLC and the hardware from the rest of the PLC application. Two tasks are created in the PLC program for this purpose. The standard task runs with the conveniently long PLC cycle time of, for example, 10 ms, while a second communication task runs with a faster cycle taking, for example, 2 ms.

Communication Principle 1:

Data buffers of type ComBuffer are used to decouple the different speeds of the fast communication task and the standard task. They are written and read asynchronously.

The function blocks described later for receiving and sending data (SendByte, SendString, SendData etc.) make use of only an additional data buffer for data exchange, and are thus independent of the hardware being used. In all cases, a communication block SerialLineControl is called in the fast task, as well as the send and receive blocks. This handles the data traffic between the data buffer and the hardware with maximum speed in the background. If a COM port or terminal with 22 byte data interface is used a second task is not needed for low baud rates. Then the communication block SerialLineControl can be called in the standard task.

The communication with virtual COM ports via SerialLineControlADS uses an ADS server. Data exchange is handled asynchronously via ADS and is managed in intermediate buffers. The server itselfs receives the incoming data of the virtual COM port independent of the PLC. So the maximal effective data transfer don't depend on the PLC task cycle time.
Only the reaction time for incoming data would be decreased by a faster task cycle time. The full delay can't be defined because the virtual-com-port-drivers and the ADS server do not run in realtime.
The communication block SerialLineControlADS usually is called in the standard task. A second task is not needed.