31
Technical support / ADC simulation
« on: August 20, 2012, 08:56:50 AM »
Hi I do try out ADC function by using variable resistor 5K.
I just assume this
Temp C Voltage ADC
-20C 0 0
+200C 5 4096
By linear relationship
(T+20)/(200 +20) =(A-0)/(4096-0)
T = (A/4096)*220 - 20
while try with value A=0 , i do get T = -20C and when A=4096 then T = 200C. mathematically correct
In my custom function i do wrote as
B = ADC(1) *220 - 20
When i do adjust the variable to minimum end, do get -20C but in maximum end i do get 900C instead of 220C. May i know what cause the error. Thanks
I just assume this
Temp C Voltage ADC
-20C 0 0
+200C 5 4096
By linear relationship
(T+20)/(200 +20) =(A-0)/(4096-0)
T = (A/4096)*220 - 20
while try with value A=0 , i do get T = -20C and when A=4096 then T = 200C. mathematically correct
In my custom function i do wrote as
B = ADC(1) *220 - 20
When i do adjust the variable to minimum end, do get -20C but in maximum end i do get 900C instead of 220C. May i know what cause the error. Thanks