Download project
This example shows how to use the serial port. Therefore the communication of two ports
with each other is implemented. The first one writes a string of characters, which is read
by the second one.
This example demonstrates how serial communication can be implemented,
how ports are opened, closed and information is read and send.
A second example shows the usage of the library SysCom
.
Application 'CAASerialComExample':
At the beginning the necessary parameters for the ports are set in an array of PARAMETER structs.
The first value is the used parameter and the second one is the value of the parameter.
The correct port numbers need to be adapted in the aCom1Params
and aCom2Params
variables.
In the following example the parameter is the port and the value is 1. So the COM1 port is used.
aCom1Params[1].udiParameterId:=COM.CAA_Parameter_Constants.udiPort;
aCom1Params[1].udiValue := 1;
If the ports are open and no error occurred one port starts writing. After this port finished writing,
the other port will be used for reading. At the end both ports will be closed and the used "Handles"
will be released.
Application 'SysComExample':
This application shows how to use the library SysCom
for serial communication.
System requirements and restrictions | Info |
---|---|
Programming System | CODESYS Development System Version 3.5.14.0 or higher |
Runtime System | CODESYS Control Version 3.5.14.0 |
Required Accessories | - |