08-24-2021 02:30 PM
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
08-24-2021 02:36 PM
Maybe this discussion can give you some ideas.
08-24-2021 02:41 PM
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.
08-24-2021 02:55 PM
@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.)
08-24-2021 04:14 PM - edited 08-24-2021 04:20 PM
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.