LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MODBUS help needed!

Hello~

I've never worked with MODBUS and I'm having a problem communicating with my device.

The "slave" is an OleumTech WM2000. I'm using a cFP-2020 as the Master.

 

The slave writes 32-bit Floating Point data to registers 7001 thru 7012 and I have no idea how to read them.

 

I've downloaded the MODBUS vi's and have also tried the "my modbus serial query.vi".

Perhaps someone could help me set-up a basic query of these registers; that's all I need to do. No writing...

 

Thanks.

0 Kudos
Message 1 of 4
(2,986 Views)

You will need to know the device address of the slave. It could be anywhere from 1 to 255 I think. You will want to use the Read multiple holding registers command with starting address 7001 and the range set to 24 registers. The modbus vi's read 16 bit holding registers. It is up to the labview code to convert the data into floating point values. There are examples on the forums that discuss this conversion. There is one other option for zero based addressing. Sometimes the devices call the first address as 0, and other devices call the first address 1. Do you have a demo program that could talk from a computer to the WM2000?? You could use portmon to watch the hex data and find the device address. Could be an issue with the cabling pinouts.

0 Kudos
Message 2 of 4
(2,981 Views)

With 32-bit floating point, you need to read the pairs of registers (which are 16 bit integers) and join the two bytes together into a 32 bit word.  So with 12 registers, you need to read all twelve and join them 6 32-bit integers.  One way of doing that is to read the entire array, decimate the array into two, and join thte two arrays together into a 32 bit array.

 

I am attaching an example where I did that.  I set this up kind of like an action engine where I have some Get and Set commands, for either reading from or writing to registers, and also turned my groups of registers into named group so I could identify them my name in my main VI.

 

See attached in LV 8.2.1

 

Note that the order of the bytes 16 bit registers matters.  It depends whether the slave is big endian or little endian, i.e. whether the most significant 16 bit word comes first or second.  If the attached example doesn't work, try swapping the wires between the decimate array and the join words function.

Message Edited by Ravens Fan on 10-06-2008 08:55 PM
0 Kudos
Message 3 of 4
(2,980 Views)

Works perfect! Thanks for the help!

0 Kudos
Message 4 of 4
(2,941 Views)