LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

negative numbers in modbus

I found on the forum a reference for reading negative numbers. Fom 0 to 360 degrees I read everything fine. I am confused on the 65xxx return below 0. Is there a way to use unsigned decimal or what is the best answer?

 

Philip Nielsen

0 Kudos
Message 1 of 9
(8,340 Views)

Not a whole lot of detail to go on here.  Smiley Wink

 

Why do you want to use an "unsigned decimal" when you are asking for negative numbers.

 

Modbus just returns a series of ASCII bytes that get typecast to a numeric value.  Perhaps you want to typecast the number to an I16 instead of the U16 that comes out of the Modbus VI's.

0 Kudos
Message 2 of 9
(8,333 Views)

Thanks for your response. I believe I need to change the control indicator to unsigned? I tried it but I still got it wrong. Please see the labeled indicator "Actual Temperature from Oven". I not if I should add any other properties? Such as double I16 etc.

 

Thanks again,

 

Philip

0 Kudos
Message 3 of 9
(8,326 Views)

I found out where I am getting the error. I am not sure how to fix it. I ran the oven temp below o and 65xxx showed up again. I attached the unmodified Modbus VI.

 

Philip

0 Kudos
Message 4 of 9
(8,321 Views)

No, change the value to a signed integer, I16.

Otherwise please provide some data, such as what value you are getting (and what type of control or indicator it is in) and what value you are expecting.
Message Edited by Ravens Fan on 07-16-2009 03:01 PM
0 Kudos
Message 5 of 9
(8,315 Views)

Works like a champ. My first VI modbus was in 8.2. I was unable to convert all the functions to 8.6.1. I put the data conversion in my FOR LOOP. Thanks for the simple answer. Sometimes we stumble more then we want too. It reads negative temperatures and positive temperature greate.

 

Thanks

 

Philip

0 Kudos
Message 6 of 9
(8,297 Views)

How do I read negative temperatures in modbus? as soon as it drops below 0 degrees celcius, it reads 6552 on labview and on the instrument itself reads correctly -10 degrees.

 

0 Kudos
Message 7 of 9
(6,150 Views)

You say it reads 6552, but do you actually mean 65526?

 

When you typecast the U16 integer of 65526 to an I16 integer, you'll get -10.

 

 

 

Did you try what I posted nearly 12 years ago in message #5?  Because that works as well.

 

 

 

 

Message 8 of 9
(6,147 Views)

Hi,

 

even the simple ToI16 works:

No need to TypeCast…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 9
(6,139 Views)