Example: Serial COM with Visualization
Product: CODESYS Development System
This example shows how to use three COM ports with a visualization of the contents of the read and write buffers.

Description
One port is used for reading, another for writing, and a third is used for reading and writing. The included visualization shows the reading and writing result together with the used parameters. In the visualization, you can switch between the three different ports.
Additional information
Before using the example, the COM settings for the connected device have to be configured (port, baud rate, etc.).
PLC_PRG
: The main program is responsible for activating the selected serial ports and sets the specific parameter values for each port, such as port number or baud rate. Changing the ports in the visualization closes the ports which are not used.SERIAL_LINE
: Initially the specified communication parameters are set. Afterwards the port is opened with this parameter list. Depending on the mode, the read or write operation is started. After reading, the buffer is stored in a variable. Before the write operation can begin, the string which should be written to the COM port is moved to a buffer variable.Visualization
: TheSERIAL_LINE_VISU
visualization module shows the used parameters, occurred errors, and the read or write result. The main visualization references this module for the different ports.
System requirements and restrictions
Programming system | CODESYS Development System (version 3.5.14.0 or higher) |
Runtime system | CODESYS Control Win (version 3.5.14.0) |
Add-on components | - |
Note
DOWNLOAD Project