There seems to be a bug with the SetLinearScale method.
this will cause unpredictable outputs, although this should work as the range is 1000 to 0 (with a raw range of 0 to 1024). GHI, Can you confirm?
It is not intended to be used that way but it should work.
Put 3.3Volts, you should see 0.
Put 0 V, you should see 1000.
Put 1.1V, you should see something like 666.
That is how it should work, however it doesn’t.
Please provide what values you see.
I have worked around the issue by writing my own scaler so I can’t check to see what the values were, but they seemed to be random and very large values as if its rolling over (overflow).
Reading resistor pot’s is very noisy and I doubt if the readings will sit nice… When reading a resistive track you must oversample by at least 4-6 times and average…
Who said I was reading resistor pots?? It is the SetLinear function that is broken when using reverse ranges.
Thanks. We will fix it. It is signed/unsigned problem. It is affecting some high bits only…
Sorry Dale I completely lost the plot… I thought the input was unstable
Shutting up now…
I suspected a roll over condition, good to know and thanks for confirming.
IanR, not a problem, didn’t mean to sound harsh.
There also seems to be a one off issue on max value.
If you SetLinearScale(-100, 100) for example, you will only see 99 max. You then need to set max to 101 to see 100. Is non-inclusive max value by design and just not documented? tia
Are you using latest SDK?
The analog raw value should go up to 1023. It could be just the Analog in not going that far…
Using 4.1.3. I do get upto 1023. The issue (if you call it that) is that 1023 is scaled to 99 instead of 100. Think it just a inclusive vs non-inclusive side effect. Are you saying that is changed in 4.1.5?
[Edit] After update to 4.1.5, it does appear that this was changed and fixed.
Is SetLinearScale not available in GHI NETMF v4.2 (beta preview)?? any alternative??
The 4.2 AnalogInput class has a .Offset property and a .Scale property. These can be used to achieve the same results. It’s usually better to post a new thread instead of digging up an old one.
thanks and sure in future I will take care of this.