Read USB Serial - RS232 Codesys

Post Reply
flopez
Posts: 2
Joined: 17 Feb 2022, 11:54

Read USB Serial - RS232 Codesys

Post by flopez »

Hi there,

I'm developing a CODESYS program which will retrieve information from sensors using multiple USB's.
Searching in some CODESYS forums I have learnt that exists a library which allows you to access to a USB to read his content. See the image below.
codesys_usb.png
codesys_usb.png (14.35 KiB) Viewed 5122 times
I also know that it is required to edit a configuration file, called CODESYSControl.cfg and add these lines:
Linux.Devicefile=/dev/ttyUSB
portnum:=COM.SysCom.SYS_COMPORT1

Despite doing all this steps, the program is not able to open a communication and read a USB. However, I have tried to read it using a python application and works perfectly.
My question is, which steps are necessary for reading USB or RS232 devices in CODESYS using the USB ports of my RevPi Connect+?
User avatar
Amar
KUNBUS
Posts: 160
Joined: 15 Jul 2019, 12:58

Re: Read USB Serial - RS232 Codesys

Post by Amar »

Check if correct COM port is configured in /etc/CODESYSControl.cfg and in Codesys Application
/dev/ttyUSB0 -> COM Port 1
/dev/ttyUSB1 -> COM Port 2 …

Refer topic configuring MODBUS RTU Serial Port
https://revolutionpi.com/tutorials/beis ... tu-master/
KUNBUS
Post Reply