ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus Library Master Slave proper example

Sorry I am having to repost this as I dont see the previous post anywhere, and this is sort of urgent for me. Is there some kind of a well documented example on how to use the modbus library MB ethernet master slave VIs to read from a modbus TCP connection? I have a Watlow EZ Zone PM controller using Modbus TCP protocol, and i know which registers i want to read to and write from, but I am not so sure how to make the required changes in the master slave VI, specially in the event structures. Could some one help me out please? I basically want to read from register 360 and write to register 2160 for now.

0 Kudos
Message 1 of 9
(6,485 Views)

I coded up something for you.  See attached.  Let me know if you have more questions.

 

Yik

 

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 2 of 9
(6,478 Views)

Thanks a lot. Where can I find the ReadWriteParameters.ctl VI that i am being asked for when I open your VI? Thanks so much again!

0 Kudos
Message 3 of 9
(6,474 Views)

See the new version of the program, attached

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 4 of 9
(6,469 Views)

Thanks so much! That was very helpful.

0 Kudos
Message 5 of 9
(6,463 Views)

Hi jyang72211,

 

I'm trying to control the same controller via Modbus RTU. The only difference is my instrument's connection with PC is over RS-232 cable instead of TCP.  I replaced MB Ethernet RW with regular MB RW vi.  I was able to communicate with the controller.  However, I received the same output values of holding registers for index 0 and index 1.  I know that I would have an array of two 16 bit values from each register and I will have to convert that to a 32 floating point bit number to get the actual value of temperature.  I believe all of my serial settings are correct but I don't know how to get these two values (given they are correct) and put out the wanted temp.  Do you have any suggestion?

 

Thank you for your help

 

Tim

0 Kudos
Message 6 of 9
(6,104 Views)

Take a look at the numeric/data manipulation palette.  There are functions on there like join number where it can take two U16 elements and join them into a U32 element.  Typecast is another function that can work.

0 Kudos
Message 7 of 9
(6,100 Views)

thanks for the tip Ravens Fan, I was able to find the join number function in the pallete but then I don't know how to go from there to get the temperature value.  I did some manually calculation from those values in array and convert them to hex then combine them in hi-lo order then convert it to 32 bit floating point then I would get the correct #. I' m not sure how to actually get it done in LabView. Do you have any suggestion?

 

Thanks

 

Tim

0 Kudos
Message 8 of 9
(6,091 Views)

Ok, I typecasted it and got the reading. THanks!

0 Kudos
Message 9 of 9
(6,089 Views)