Hello,
Does anyone have experience with Modubus RTU communication between Arduino and PLC?
I would need help communicating between an Arduino Nano Every and a Siemens S7-1200 PLC (specifically the 1212C AC/DC/Rly) using the Modbus RTU protocol. I am using a TTL to RS485 converter (MAX485) at Arduino side and RS485 communication board (CB1241) at PLC side.
PLC as Master and Arduino as Slave. I have a total of 4 slave devices. Communication on the PLC side is somehow solved with a simple script. I'm not so sure about Arduino. I tried the ArduinoModbus.h example Kitchen Sink library, which worked 100% between two arduinos. After the modification, when I want to light the LED on pin 13 after a command from the PLC using the Coil or the value in the Holding register, it no longer works so well.
I checked the flow through an oscilloscope and the data is in the correct format in both directions. However, Arduino "doesn't want to scramble" the data in any way.
I tried different libraries but with exactly the same result. I've been messing with it for over a week now.
After solving the problem, I will share the working code to future generations in trouble.
Thank you
Regards
Jenda