11-14-2019 03:19 PM
Hi,
I have a Modbus serial code, but my conversion is wrong, I have tried the solutions that I found in others posts, but I didn't have a success. My code is attached. May someone help me?
Thank you in advance.
Solved! Go to Solution.
11-14-2019 04:08 PM
It looks fine to me.
So if something is wrong post a VI that has some data saved in it as default and tell us what you expect the values to be.
11-14-2019 04:11 PM - edited 11-14-2019 04:11 PM
We need to know that you are trying to convert and how...
See my reply to a similar question here and see if that is what you need to do
11-15-2019 07:27 AM
Here is my table,
In this table you can see the conversion, my number is 65436, it should be -10C, when that number is positive for instance, the temperature is 30C, the number shown is 300, in this case need to divide by 10, but when the number is negative, I can't apply the same rule.
Thank you
11-15-2019 08:12 AM - edited 11-15-2019 08:14 AM
What does the monitor say about those registers?
Those don't look like paired registers, but only a single register.
It looks like you need to typecast your register to an I16 integer, then divide by 10.
11-15-2019 08:30 AM
That is perfect, Thank you so much RavensFan.
Yes, my monitor shows me a single registers.
May you suggest me some course, or tutorial about the registers conversion, I would like to understand more about it?
11-15-2019 08:37 AM
One thing you can read if you haven't seen this is the Modbus spec http://www.modbus.org/specs.php
The other thing to read is the manual for your device and see how they describe the data for each register your interested in. This manual should have said that the U16 register contains the value in an I16 format and that you need to divide by 10.
The other thing to understand is the various ways numbers can be represented in computer memory. 8, 16, 32, 64 bit, signed vs. unsigned. integer versus floating point. What 2's complement means as that is what is used for negative numbers in signed integers.