LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get a floating type data if using modbus library NI?

Can I get a floating or long data type if using the NI modbus library? If possible, may I have an example to read a value in the holding register. thank you

0 Kudos
Message 1 of 5
(803 Views)

Maybe this discussion can give you some ideas.

0 Kudos
Message 2 of 5
(802 Views)

I repeatedly made simulations to store data in a holding register that has a decimal number, when I read the modscan for this simulator the decimal appears but when I read it using the NI library the decimal is not there.

0 Kudos
Message 3 of 5
(797 Views)

@Purnama210 wrote:

I repeatedly made simulations to store data in a holding register that has a decimal number, when I read the modscan for this simulator the decimal appears but when I read it using the NI library the decimal is not there.


We cannot really help unless you show us some code. Maybe your "simulation" is faulty? Maybe you are not using the library correctly?

 

What is "the decimal"? (the entire value? decimal point? decimal comma? etc.)

0 Kudos
Message 4 of 5
(786 Views)

Your Modbus device should have come with a user manual.

 

Inside the manual there should be some sort of "register map" that tells you what register or registers hold the data you are interested in and how to merge and scale the integers to get the value in floating point. 

 

Since most Modbus registers are limited to 16 bit integers you will often have to read multiple registers, byte merge the results, and then convert that to a floating point, possibly using a scaling factor.

 

For instance I used an Accuvim power analyzer in a project and made this VI for all the common measurements. 

 

modbusregisgers.png

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 5
(762 Views)