Download project

Serial COM with Visualization

This example shows the use of three COM Ports. One port is for reading, another for writing and one can do both.
The included visualization shows the reading and writing result together with the used parameters.
The user can switch between the three different ports.

Product description

This example includes the communication with a serial COM port. In the visualization can be decided
if one port should be used for both reading and writing or if two ports, one for reading and one for writing
should be used.

More information

The correct port numbers needs to be adapted. The use of devices requires the adaption of the several parameters.

PLC_PRG: The main program is responsible for activating the chosen serial ports and set the specific parameter
values for each port, like port number or baud rate. By changing the ports in the visualization, the unused ports
will be closed.

SERIAL_LINE: Initially the given communication parameters are set. Afterwards the port is opened with this
parameter list. Depending on the mode, the reading or writing process will be started. After reading, the buffer
will be saved into a variable. Before the writing process can start, the string which should be written to the COM port
is moved to a buffer variable.

Visualization: The SERIAL_LINE_VISU is the visualization module which shows the used parameters, occurred errors
and the reading or writing result. The main visualization references this module for the different ports.

System requirements and restrictions

System requirements and restrictions Info
Programming System CODESYS Development System Version or higher
Runtime System CODESYS Control Version
Required Accessories -

Screenshot thumbnail
Screenshot of Visualization