First, in the MODBUS configuration, you want to read the register 128 so it's a robot's input. It needs to be a "Register Input" and not a "Register Output".
Then, you should put the line "var_1:=read_port_register(128)" in a thread to make it works (don't forget to put a "wait 0.01s").
With your actual code, you only read once the register concerned, when the blue cursor pass on it so if it's not at the value 500 at this time, you'll wait forever. Putting it in a thread, you'll read it "continuously".
I don't know if then it will works but you can start changing this.
agiakos
Hey @Loïc you mean that I need to put the line "var_1:=read_port_register(128)" inside the moveL and after that line the wait command?Loïc said:First, in the MODBUS configuration, you want to read the register 128 so it's a robot's input. It needs to be a "Register Input" and not a "Register Output".
Then, you should put the line "var_1:=read_port_register(128)" in a thread to make it works (don't forget to put a "wait 0.01s").
With your actual code, you only read once the register concerned, when the blue cursor pass on it so if it's not at the value 500 at this time, you'll wait forever. Putting it in a thread, you'll read it "continuously".
I don't know if then it will works but you can start changing this.
Loïc
You're welcome
Hello Community,
I made a small program to check my MODBUS connection. It seems like I can not read the register value or detect changes.
My code stucks here even when I change the register value from zero to 500. Is my approach/coding wrong?
Edit: I was able to make it work with the function modbus_get_status_signal("register name",false)