LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems using Modbus TCP accessed by NI OPC Server

Solved!
Go to solution

Hi there,

 

i'm using NI OPC-Server to access a measurement module. The buildup is quite easy, my system with NI OPC, a modbus gate and there the module connected with RS485.

There's a thermocouple to provide me some sample data.

But there's the point. I know, my data is in the Holding Registers and I can access them, but every data type I'm trying doesn't bring my my data out, just any other (sometimes Huge with e34, sometimes very small like e-13...) sorts, i can't understand.

The type provided by the module should be single precision.

In Lookout the address used to be is 41000 in Labview it's just 999 and in the "target" OPC-Server I get some values at 401000 but not useful.

I also get the same results accessing 301000 in different types.

Read/Write or Read Only is equal.

I've tried to tell my OPC that the values are Strings, Floats, Words, BCD and all other possible ways OPC offers me, but nothing results in a usable temperature.

I hope I missed something and you could suggest it.

 

Cateros

0 Kudos
Message 1 of 5
(3,328 Views)

A Single Preceison Float would span 2 registers 401000 and 401001. A Double would span 4 registers 401000 to  401003. Many times a value from an external module or sensor will come in as a raw inteer and will need to be scaled to provide the correct value. For instance a presure sensor may provide a signal with a value ranging from 0-4096 as a raw integer range however its scaled engineering value will be 0-100 % as a Float. Static tags in the server have a scaling tab where you can set a linear scaling range.

 

Your documentation should specify if the module consumes 1 or 2 registers and if it is a raw integer or actal float. The description of what you are seeing tells me it is a single register. 

Fred Loveless
Kepware Technologies
http://www.kepware.com
0 Kudos
Message 2 of 5
(3,306 Views)

Thanks for your reply.

 

in LabVIEW I'm using the provided Modbus Libraries. If I unbundle the Holding registers, my value appears at Holding Register [0], I'm type casting it to single and get the sample temperature. (Address 999->unbundle->typecast->value)

 

In NI OPC, I'm reading ( [depends on zero based addressing]  300999/301000 equal to 400999/401000) an already typecasted Holding Register [1] compared to LabVIEW (and the value changes in the second or third digit behind the comma and they are changing at the same time). Data type in the tag is float.

 Another disturbing thing is even if I change in the options "using zero-based addressing in registers" my value does not change.

If I'm reading two addresses close to each other (as you mentioned 401000-401001) I'm getting an unknown data type and no results. How do I read multiple addresses without such errors? And how do I specify a special register to read?

 

Scaling should not be the problem, I am having three ways to get my value (FTP-Server on the gate (just a *.dat file with correct type), software the the module manufacturer (while measuring and configuring the module) and LabVIEW(as can be seen above)) .

 

Sadly, I have not found any useable modbus documentation about the module (just it can use modbus, you have the registers, you could read/write and fine)

When I'm adding a second couple to the module, in LabVIEW Values in Holding Register [2] and Holding Register [3] appear and are changing.

 

Cateros

0 Kudos
Message 3 of 5
(3,299 Views)
Solution

Finally the problem is solved.

 

We've tried some other setting for the modbus-device in NI OPC as Use Modbus function 06 for single register writes. Use Modbus functions 05 for single coil writes and Use default Modbus byte order.

These settings were not default and i tried some combinations but badly not these.

 

As data type for the tag we've tried short and got the data content of Holding Register[0].

Now it works and the value is the typecast from Holding Register[0] and Holding Register[1] and I got the temperature.

Already you were quite right, thanks again.

 

Cateros

0 Kudos
Message 4 of 5
(3,295 Views)

Hello,

 

in fact I am facing the same problem. Would you please help me to solve it. Please find attached teh screenshots of the configuration of NI opc servers.

 

Thank you.

0 Kudos
Message 5 of 5
(1,935 Views)