Page 1 of 1

Offset in Analog IO

Posted: 18 Sep 2017, 15:22
by FedericoDC
Hello,
I have a flow sensor connected to the Analog IO. Its output is specified from 0 to 5V, but is actually 1V at no air flow When I connect it with multiplier 1, divider 1 and offset 0, I get a measure of 996, which seems to be ok. Multiplier and divider work as expected. Offset only seems to work for positive values, I can't get the 996 down to zero.

Re: Offset in Analog IO

Posted: 18 Sep 2017, 18:11
by volker
Hi Federico,
I'm so sorry to cause trouble but this is a known bug and we have already fixed it last week. There will be a package update this week and we'll inform via the "News and Announcements" (best way would be to subscribe that topic) as soon as it is online. meanwhile I would like to ask you to use a somehow silly workaround:
Please convert your number (e.g. -996) into a 16 bit hex number and enter this number in the value editor using the common syntax "0xyyyy" where "yyyy" stands for the 2 byte hex value (e.g. 0xfc1c for -996). But please note that the offset needs to multiplied and divided (i.e. scaled) by the multiplier and divisor before entering it (in order to meet the formula given in the tutorial y = m/d*x + o where x is the original number and y the number you want to get) . So in your case you might want to scale the 1-5 V to a physical value of air flow of unit l/s or so. Let's say 1 V would be 0 cm³/s and 5 v would be 650 cm³/s. You want to scale a 4000 mV span to a 650 m³/s span. So you need to multiply with 325 and divide by 2000 to get this scaling. The offset would then be -996 * 325 / 2000 = -161.85. So you would enter -162 but because of the bug you would need to go by hex which is 0xff5e.
In case you do not know how to convert decimal into hex: Please use the MS Windows calculator in "Programmers View", enter the number -162 with radio button "Dec" checked and then with "Word" and "Hex" checked you get the readout for the hexadecimal value "FF5E".
Hope this will help and you get things running!

Re: Offset in Analog IO

Posted: 11 Oct 2017, 11:30
by FedericoDC
I forgot to say thanks :)
Grüße

Re: Offset in Analog IO

Posted: 11 Oct 2017, 11:51
by volker
:P :D