sergei
hello,

how to change the Slave ID, because when i use "qmodbus" or "mbpoll" , they ask me for a Slave ID who start from 1.
0 dont work.

I tested the both programs with a "velocio PLC" named "ace11" and it work.(because i can change the Slave ID )

i ask you because i'm just started to learn the modbus protocol, and i wanted to test it on my arduino.
thiagoralves
OpenPLC accepts any slave id. It does not care about what is the slave id number.
Reply 0 0
sergei
this is my simple program :
auto maintien arduino.png 
Now i open it with OpenPLC. In "Slave" i have this :

openplc_slaveID.pngSlave Id cannot be changed. 

Now, i want to read with Modbus if the LED is ON or OFF.
I use qmodbus and i have this (LED is ON):

qmodbus4.png 
you can see that in data i have only 0 (but LED is ON), and that the Slave ID begin at 1.

When i make the same circuit with a "Velocio PLC" (Slave Id : 1 and coil :9) i get this:

velocio_qmodbus.png 
you can see that the LED on coil 9 is ON.

this is why, i think, i need to change the Slave Id.
Reply 0 0
thiagoralves
You need to use qmodbus to talk to OpenPLC, not your Arduino. That configuration of slave id is an internal configuration for the communication between OpenPLC and your Arduino. It should be invisible to qmodbus. Therefore, to read the status of the LED, you need to make qmodbus target OpenPLC (use OpenPLC IP address, if OpenPLC is running on the same machine as qmodbus, use localhost), then on start address put 800. As you can see from your program, the LED is at address %QX100.0. That translates to Modbus address 800 for OpenPLC.
Reply 0 0
sergei
my mistake was to start adress at 0 or 100 in place of 800.
now it's working.

thanks.
Reply 0 0
Reply