From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Read power meter in LabVIEW via RS-232/RS-485

Solved!
Go to solution

Hi again!

 

So I have used the modbus library and I get some information from my device, unfortuneatly I need some help with understadning the reading values that I get in the example I'm using  ( see attached VI). 

 

In my protocol I have a physical adress that I want to access, this address is in ASCII code, 0032h, if converting to decimal i get 50, which is the starting adress I use in my program. If I run my program I get different values like 20K and 6k range, complety random numbers in the reading register. But if I read on my power meter it says around 500W.  How do I convert this number to something real? 

 

Best regards Maurlind!

0 Kudos
Message 21 of 27
(3,582 Views)

Most MODBus protocols will state there is a conversion from the U16 data to the real value.  So read through the manual and make sure there isn't something like you need to divide by 10.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 22 of 27
(3,580 Views)

go to my page, i have that problem too long time a go but now its solved
http://forums.ni.com/t5/LabVIEW/MODBUS-RTU-multiple-request-amp-response-NI-VISA/m-p/2857414#M832974

 

Regards,

 

rhiesnand

0 Kudos
Message 23 of 27
(3,560 Views)

Hi rhiesnad!

 

So I looked in your older thread and tried the type cast thing with U32 to DBL and U32  to U16. The problem still exist i get huge numbers that dosen't represent the real power value. 

I have attached the program that i took from your thread, the difference is that I have only one slave and not two that you had. 

 

In your thread you also go huge numbers, and that you said that the slave was produceing values in the standard IEEE 754, mine is dosing the exact same thing. It is sending out the values in the format IEEE 754 according to my device protocol. How do i represent it in the correct form? 

 

What is it that I'm doing wrong here?

 

Best regards Maurlind!

0 Kudos
Message 24 of 27
(3,521 Views)

I also tride the swap word function after the type cast, the only difference is that the high values is stable and pendling around 1,130E8.

 

 

Best regards Maurlind!

 

 

0 Kudos
Message 25 of 27
(3,502 Views)

Does it matter which connection type of RS-485 you use? I'm currently using 2-wire connection, since I didn't get 4-wire connection to work properly.

 

Best regards Maurlind!

0 Kudos
Message 26 of 27
(3,481 Views)
Solution
Accepted by maurlind

Hi!

I managed to solve my problem on my own. Turns out that from the type cast function it gave me Uint16 and I need float32 to see the problem . So I change the constant of the type cast function to SGL instead of Uint32 and put that and the numeric indicator in a for loop.

 

Best regards Maurlind!

0 Kudos
Message 27 of 27
(3,436 Views)