Hello. I made the same like you but with MODBUS RTU using a max485 chip to convert ttl signals to rs485 standard (plug on pins 0, 1 and 2 on arduino pcb)and the usb port from the raspberry pi. It works very well.
Maybe you have a problem with the number of register to read. I think arduino can't stor on its buffer more than 64 words.
As I told you before, my system with four arduino hanging from a raspberry pi serial port works very well, even if I turn off any arduino pcb it continues working.
BR
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello everyone.
I encountered a problem reading the modbus TCP registers in Codesys.
Registers are correctly read in eg. ModbusScanner, but in Codesys I can not read any values.
I am trying to read eg. Input Register offset 100.
Due to this difficulty I can not continue the project, I am asking you for help in configuring Codesys. What to do to read anything over Modbus TCP.
I'm attaching a program file in Codesys and Arduino Uno with Ethernet Shield.
Sample of code for Arduino:
//Modbus Registers Offsets (0-9999)
const int SENSOR_IREG = 100;
//Used Pins
const int sensorPin = A0;
I will be grateful for your help, greetings. !!!
RPI1_1.project [194.35 KiB]
RPI1_1.project [194.35 KiB]
Hello. I made the same like you but with MODBUS RTU using a max485 chip to convert ttl signals to rs485 standard (plug on pins 0, 1 and 2 on arduino pcb)and the usb port from the raspberry pi. It works very well.
Maybe you have a problem with the number of register to read. I think arduino can't stor on its buffer more than 64 words.
As I told you before, my system with four arduino hanging from a raspberry pi serial port works very well, even if I turn off any arduino pcb it continues working.
BR
hello juan, thanks for yours advice!
for me, the solution was different.
I used the 28j60 ethernet shield model and there was a problem.
I bought a classic shield Ethernet "Arduino Ethernet shield R3 with micro SD connector"
like this:
https://botland.com.pl/produkty-wycofan ... crosd.html
and the connection worked!
Settings:
for input register code 4
for register 100, enter offset 0x0064 in the channel
The whole works perfectly with raspberry pi 3 B +