LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MODBUS RTU Floating point data 32bit

I'm trying to pull data from the registers of a Power Monitor (Conzerv EM 6459) which communicates using MODBUS RTU.  The data format for the power monitor is 32bit floating point, occupying two 16 bit register addresses per data point.  My problem is that i can't successfully pull two appropriate registers and read them to give a single data point.  I am to the point where I'm reading the separate registers, but am unable to correctly format them.  Thanks to a post found on this message board (http://forums.ni.com/ni/board/message?board.id=170&thread.id=285030) I beleive i'm on the correct trajectory for solving the problem (see attached code).
 
Instead of giving me 20 separate data points (a block of 20 addresses is called), the program combines sets of registers to give 10 numbers.  The problem is that the numbers still don't match what is being displayed on the instrument display.  Any advice would be appreciated. 
Paul
 
0 Kudos
Message 1 of 15
(14,662 Views)
One thing to check is the order of the registers, the "endianess".  Whether the most significant register comes first or second.  Try crossing the wires going into the Join numbers function to see if the results make more sense.
0 Kudos
Message 2 of 15
(14,642 Views)
First of all, you are converting to I32, which is not a floating point number, but an integer. You need to typecast your data to SGL (32 bit floating point).
 
On top of this, you need to know the byte order.


pmajsz wrote:
The problem is that the numbers still don't match what is being displayed on the instrument display. 
One important piece of information would be what kind of SGL numbers you actually expect for the data shown in your FP image.
 
Easiest for us would be if you could reduce your code as follows: Run the VI so the "all registers" indicator contains valid data. Now turn it into a control and make the current values default. Delete all the acquisition code so it looks similar the attached image. Add a comment on the diagram containing the SGL numbers you expect. Save the VI under a new name and attach it here.
This way we can easily test what the byte order should be.
 
 


Message Edited by altenbach on 05-03-2008 09:06 PM
0 Kudos
Message 3 of 15
(14,630 Views)
Here's one possible solution, that give "nice numbers" for two of the values. Of course all bets are off without knowledge of what the values should really be.
 


Message Edited by altenbach on 05-03-2008 09:30 PM
Message 4 of 15
(14,625 Views)

Thanks!  The code seems to be working properly now, thanks to the suggestions of Raven's Fan and Altenbach.  The original problems were that 1) the wires needed to be reversed on the Join Numbers function and 2) the data needed to be typecast to floating point.  Attached is the final version of the code (Altenbach, your second post was 100% correct, producing numbers which were the same as the display on the instrument). 

I'm still a little confused about the typecast function; what should the "type" input be changed to?    I read the help section in Labview, but am still unsure about what this should be changed to. 

 

0 Kudos
Message 5 of 15
(14,583 Views)
The type input is just that, a type. It determines the wire type that exits on the right. (The values in the type input are irrelevant!)
 
All you need is a 1D array of type SGL. The array can be empty.
0 Kudos
Message 6 of 15
(14,578 Views)
Now i understand!  I thought the values in the array had meaning.  Thanks, Christian! 
paul
0 Kudos
Message 7 of 15
(14,570 Views)

hey man, I'm using a multimeter that measure electrical values, it uses a modbus-rtu protocol and a usb to rs-485 converter to communicate to the computer, when I connect it to the computer it appear as a COM4 port. Could you teach me how do I do a VI to read the values of the multimeter? I've red on the user manual that I have to use the function 4- read input register to get that values.

0 Kudos
Message 8 of 15
(12,865 Views)

Hi, 

I noticed you also posted in this thread.  You may gain more visibility if you start a new thread.  

http://forums.ni.com/t5/LabVIEW/Reading-Words-from-Temperature-Controller-Registers-Using-Modbus/m-p...

 

Dave T.

National Instruments
FlexRIO & R-Series Product Support Engineer
0 Kudos
Message 9 of 15
(12,857 Views)

Hi Filipe,

            Using of this lib file, you can talk with multimeter.

 

I hope the lib will help for u.

 

Siva.

Sivaraj M.S
CLA
0 Kudos
Message 10 of 15
(12,850 Views)