LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write values to PLC addresses via MODBUS/TCP

I am trying to write values to some addresses on a PLC connected to my computer with MODBUS/TCP. I've mapped the addresses that I would like to write to on my project's MODBUS library as shared variables. However, I seem to neither be able to read from nor write to them these addresses. I've tried viewing the variables in LabVIEW's Distributed Systems Manager and the variables, when configured as read-only or read/write, report an unknown value, and when configured as write only, they do not display a value.

 

I've verified that the PLC is connected properly, and I am able to read from other addresses on the PLC that I do not wish to write to. There also does not appear to be a communication error either. I have also successfully read from and written to the addresses using a third-party application, but for some reason, Labview will not do the same.

 

Any suggestions on what might be wrong?

 

Thanks!

0 Kudos
Message 1 of 4
(2,634 Views)

Hello Griffon,

 

How did you set up your Modbus I/O Server? Did you follow the steps in this document?

Connect LabVIEW to Any PLC With Modbus

 

Make sure when setting up your server that you put in the IP address of your PLC (not localhost, or 127.0.0.1). 

Also make sure that you're adding variables using the "create bound variables" dialog.

 

If you did set everything up in that way, and it still not working, can you clarify what you mean with this sentence?

"I've verified that the PLC is connected properly, and I am able to read from other addresses on the PLC that I do not wish to write to"

Does this mean that you can read values out of the PLC using modbus, just not the values you want?

Colden
0 Kudos
Message 2 of 4
(2,618 Views)

Hello Colden,

 

Thanks for your reply. I do indeed mean that I can read values out of the PLC, just not the values at the addresses that I want. I've set up my MODBUS server in exactly the same way that was described in the document you've linked to. I've also specified the PLC's address in the library's properties and I've bound variables with the bound variables dialog.

 

Also, like I said, I can read and write from those same addresses that I am having trouble writing to using LabVIEW using a dedicated third party MODBUS polling software installed on my computer.

 

Thanks.

0 Kudos
Message 3 of 4
(2,610 Views)

Hello Griffon,

 

What are the tag types that you are unable to read? If it's easier, attach your project file and library file, and indicate which addresses are not working.

Colden
0 Kudos
Message 4 of 4
(2,607 Views)