Home› Troubleshooting
Discussion
Back to discussions page
agiakos
Posts: 15 Apprentice
Modbus connection/read registers value |
253 views
|
Answered | |
/ Most recent by matthewd92 |
8 comments |

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)


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)


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.
The Thread function will run like an infinite loop which will check the status of your port.
When this code executes it will wait for the register to become 500, then execute the popup, wait again for it to be 1000, execute the popup, etc.
Like this
We use this whenever we need to synchronize activities or motion between robots in a cell.
I would like to sent the wrist3 position through a modbus register but I do not know how to do it.
I thought to try the command get_actual_tcp_pose() , but the register reads only one value.
Do I have to read the value of register 275 and get the position in rads?
If you want to have a register of the actual joint rotation create a modbus client to IP address 127.0.0.1 and then connect an input register to port port 275. This will now hold the value of the wrist 3 in milliradians. You would need to multiply by 1000 to get radians.