LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus TCP

Hello

 

I tried as suggested but still only returned 1 value outside of the loop with tunnel set to indexing

 

 

0 Kudos
Message 21 of 28
(821 Views)

An update, but using a for loop on the read registers i was able to read in multiple addresses.
Dont trust values being returned as i am trying to read ambient values so my values are just way out. It could be how i am doing the modbus float conversion.
In a nutshell, still unsure (1)why read 10 values doesnt happen, (2)not sure on data being received and (3)not sure of my conversion. are they all linked to the same route cause? ie. communicating device is still modbus 485 and not modbus tcp?

Any help would be very appreciated

Thank you in advance

Lee

0 Kudos
Message 22 of 28
(799 Views)

its root cause, not route cause. As in "seems you rooted it" ,-)

-the conversion:

A) you have to check if its big or small Endian. But I am not sure if there is something in Labview that reads modbus registers as 32 bit

B) you read register 00E7, next 00E9. Normally next one should be 00E8. And you said you want float numbers. Now, modbus registers are 16 Bit. Float is 32 bit.

 

So what you can do:

1) if it does not have to be THAT accurate:  Say you have 12.34 degrees. Then you multiply by 100 and you have an integer 1234. This you send as UINT, can have 65535 max. So if you always have positive, less than 65 degree, can even multiply by 1000. This then you can send in a single 16 bit register, divide by 100 or 1000 at the other end, say 1234 by 100 is 12.34 again.

2) if you really want float numbers, then you have somehow have to pull that number apart into 2 x 16 bit values. And have to agree that 1st register (00E7) gets the higher, 2nd register  (00E8) lower  side of these values. Then on the other side you do first 16 bit * 2^16 (65536) (register 00E7) then add that the next 16 bit from register 00E8. This is the Endian part.

0 Kudos
Message 23 of 28
(785 Views)

Hello

Root / Route ... I'm normally a spelling policeman, but that one slipped by, just shows how this is getting to me. 🙂
Thank you for the advice, and my apologies for slow reply to you, I am juggling multiple projects at the moment, thankfully i have a bit of breathing space on this one, but it is fast running out.
I will try what you suggested and see how that goes. One question, If the registers are being populated, can I trust that i am receiving good data? I do not know why i am untrusting of it

Many thanks again

0 Kudos
Message 24 of 28
(752 Views)

reg. good data, modbus protocol has a CRC check. I guess there will be an error. Also the VI will throw an error, if the connection is missing.

I see, there is another thing missing in your VI: error output, for diagnosis you should really put one in.

Also, better run it in a loop, every 1 s or so, Then, if data keeps updating / changing (as there is always some noise), you know its working. Plus, if possible, get an instrument with an indicator (flow meter etc, not sure what you are measuring). Then you know at the instrument side, if its working.

0 Kudos
Message 25 of 28
(730 Views)

You can just write a simple program or put a VI, which can just display the values from Modbus output, take those values and compare with those values from your project. I think this method can help you to ensure that values from your project are correct. 

0 Kudos
Message 26 of 28
(706 Views)
Did you try the TruePort software provided by Perle? I haven't used these serial to ethernet converters yet but was about to buy several for some new test setups, so I can't go much further than suggesting you look into it. You'd then use the serial modbus drivers with the virtual com port.
0 Kudos
Message 27 of 28
(688 Views)

maybe you can just put a sender and a receiver VI in the same line, then you see what happens? But also its very handy to build yourself a modbus sniffer and use ioninja to listen in the actual conversation. All you really need is a modbus TCP to USB converter, should cost about 10 bucks.

0 Kudos
Message 28 of 28
(666 Views)