Page 1 of 1

Read USB Serial - RS232 Codesys

Posted: 17 Feb 2022, 12:06
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 6125 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+?

Re: Read USB Serial - RS232 Codesys

Posted: 18 Feb 2022, 12:18
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/