From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Industrial Communications

cancel
Showing results for 
Search instead for 
Did you mean: 

modbus tcp

Hi All,

 

I am currently working on establishing modbus TCP connectivity between my third party modbus client and labview server. I am using labview 13 and installed the NI modbus library. I am new to labview and searched for examples and got the MB Ethernet example slave.vi . I have questions on this vi.

 

1. How the slave init(poly).vi works? and how to initialize the registers and coils in the register manager.vi? where are these stored and how to identify the address of the coils and registers?

 

2. How the ethernet demon.vi works? is it updating the tables by the commands from master, how? as i could not go inside the Invoke RUN and see the code.

 

3. In the event structure, can you explain how the following work in this VI

 

a. [0] read all coils, read all holding registers

b. [1] write input registers

c. [2] write discrete inputs

 

overall just curious about how the data transfer is been happening between master and slave using the above icons in this VI.

 

Thanks in advance

sridhar

0 Kudos
Message 1 of 7
(7,230 Views)

Hi Sridhar,

Which Modbus library are you referring to?

 

Modbus Library for LabVIEW

http://zone.ni.com/devzone/cda/epd/p/id/4756

 

If you are using this one, I would recommend using the new and improved API instead:

Modbus API for LabVIEW

https://decibel.ni.com/content/docs/DOC-30140

 

Please direct questions on the new API to this forum:

https://decibel.ni.com/content/thread/17712

 

Good luck!

Joey S.
Senior Product Manager, Software
National Instruments
0 Kudos
Message 2 of 7
(7,222 Views)

Joey is right about using the new forum, the main developers monitor that thread. 

 

As a quick rundown to your questions: 

 

1) There is a slave API pallete with an example on it. Because it is a slave, you just use the read and write to update the local registers. By default, the standard modbus set of registers is defined for you.

2) The TCP daemon just sits and waits for data from the master. It updates the local data automatically. 

 

Jesse Dennis
Engineer
INTP
0 Kudos
Message 3 of 7
(7,218 Views)

Thank you all, i am using NI modbus121 library.....i will use the latest library that you guys suggested and see how it works....

 

Thanks,

Sridhar.

0 Kudos
Message 4 of 7
(7,213 Views)

Protip for Joey and Jesse, any VI with "MB" in the name is from the old library. Works every time 🙂

 

Either way, it sounds like the questions were more on the topic of how data is transferred around the environment more than just the modbus example. In the new library, we use a tool called "data value references" and I recommend searching ni.com or looking at the labview help for more details on how those work. The old library (v121) uses a functional global to store data. A part of modbus is that all memory is on the slave, so all of the slave functions directly access a giant table of 65,535 coils, discrete inputs, input registers, or holding registers (1xxxxx, 2xxxxx, 3xxxxx, and 4xxxxx values in the traditional form) as requested. Thus both your code (the event structure in the example) and the daemon code access that one shared table of values.

 

Thanks,

Daniel

Message 5 of 7
(7,175 Views)

Hello,

 

I am trying to communicate with a facility plc through Modbus TCP/IP communication. I am new to this method but the idea is that the plc will change the value of a tag in each 100ms time and i need to plot both real time trend and historical trend in labview for the same tag. I did the Modbus TCP configuration as per the information provided in the following link.

 

http://www.ni.com/white-paper/13911/en/

 


Also in Labview i did the trend configuration. I am getting both trend in labview, but the problem is the values from plc are not updating correctly. In Labview somany values are missing and the trend is not in the excat shape. I tried with different timer in Labview, but i am not getting the exact trend with 100ms time.


Instead of 100ms timer in PLC i used 1s timer, at that time the trend is comming perfectly. Can anybody help me? Just remember that i am using only one tag at present time. I need to update the tag value in labview in 100ms. I am also attaching my test.vi here. I searched a lot for the olution and found that, there are some time/timeout settings in Labview using "VISA" functions. But i am not able to catch it.If somebody can help me, It will be more helpful.

 

Thankyou,

 

Shridhar

0 Kudos
Message 6 of 7
(6,795 Views)

hanamannavar,

 

Did this issue arise after adding the Trend Express VIs into your LabVIEW VI? I recommend following the white paper you mentioned, wiring the data into indicators, and ensuring that the data is being updated at the correct rate before adding these express VIs.

0 Kudos
Message 7 of 7
(6,742 Views)