LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus data

Khalid and Unclebump,

Thank you for your help, but I found that one of the modbus vi "MB Modbus Command to Data Unit.vi" is typecasting my data into U8 numbers.

If I typecast it to U16, the CRC-16 Vi cries.

I have found one register on my drive system that can take long integer, which I can point it back to my setpoint register. But now, it's the modbus vi that's coercing my 140000 into 8928.

Thanks,

0 Kudos
Message 11 of 15
(1,238 Views)

Chokro,

This one register on your drive system, how does it take a long integer?  Since all Modbus registers are 16-bit ones, it must be reading a combination of these to interpret it as a long integer, right?  We have to find out how exactly it does this, so we can split the 140000 into 16-bit chunks, and write to the right registers. 

Similarly, some devices support floating point numbers.  But we still are limited by Modbus protocol to U16s.  So, typically, the IEEE floating point notation is used to split the number into U16 chunks and written to multiple registers.  The device then does the reverse -- reads these chunks and interprets the floating point number.

Regards,

-Khalid

0 Kudos
Message 12 of 15
(1,233 Views)

Khalid,

I have got this app. note from the device vendor and it looks similar to what you were saying- write 16-bits in two registers and combine the MSW and LSW.

Attached is the note. Also, it requires 6 digit modbus addressing. Does labview support it? I tried putting a 6 digit starting address and it didn't work.

Any ideas?

Thanks,

0 Kudos
Message 13 of 15
(1,213 Views)

Have you tried omitting the "4" and using the remaining 5 digits for the address?  Normally, the "4" is not used in the actual Modbus message since the function code implies it's a Holding register.  This might work, but am not sure what would happen for registers with 40xxxx, since LabVIEW will ignore the preceding 0s.

Also, don't forget to decrement the address you use by 1.  E.g., for 412345, you should try 12344, since the actual data is at 0 whereas the register addressing starts at 40001.

Regards,

-Khalid

0 Kudos
Message 14 of 15
(1,208 Views)
FYI,
I was able to solve my mystery of writing to 32-bit registers through a work-around. I used an on-board PLC of the device and used multiplying factor to write to the register I wanted.
 
So, first I took the register that took long integer. I multiplied it by 1000 (for three decimal places) using the PLC logic and then pointed it to the register that I was having trouble to write.
 
Anyhow, it was a happy ending. Thank you all for your support.
0 Kudos
Message 15 of 15
(1,177 Views)