How to implement Vref and Vin(-) on an ADC0831 ???
I needed some input on how the ADC0831 works when using V- and Vref.
·
For example: I was under the impression that if Vref = 3Volts and Vin(-) = 1Volt then I could read a span of 2 volts giving a 0-255 byte value. This is not the case though.
·
I found it a bit confusing that on page 197 of “Process and Control guide” that stated if Vin(-) is set to .7V and Vref is set to .5 volts the ADC will convert the range on .7 to 1.2V to a byte value of 0-255.
·
Could some one please explain to me in more detail how this is the case. I want to be able to read from 2V to 3V and still get a byte value from 0-255. I am also using the setup like this picture is showing.
·
For example: I was under the impression that if Vref = 3Volts and Vin(-) = 1Volt then I could read a span of 2 volts giving a 0-255 byte value. This is not the case though.
·
I found it a bit confusing that on page 197 of “Process and Control guide” that stated if Vin(-) is set to .7V and Vref is set to .5 volts the ADC will convert the range on .7 to 1.2V to a byte value of 0-255.
·
Could some one please explain to me in more detail how this is the case. I want to be able to read from 2V to 3V and still get a byte value from 0-255. I am also using the setup like this picture is showing.
Comments
So in the example, Vin(-) is 0.7 and Vref is 0.5 the the ADC reads from .7 to 1.2 (.7 + .5 = 1.2).
Your Vin(+) needs to fall within that span.
So for your 2 volts to 3 volts, you need to set Vin(-) to 2 volts and Vref to 1 volt. then your range is 2 to 3 volts (2 +1=3).
The voltage you want to measure must then be between 2 and 3 volts.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Rick
What temp sensor are you using and when you get your ADC working, could you post your code? Thanks.
I am using an LM235 and my code for this bit of hardware is:
[noparse][[/noparse]code]
' {$STAMP BS2sx}
' {$PBASIC 2.5}
'######################################################################################
'######################################################################################
ADC_CS PIN 15
ADC_CL PIN 14
ADC_DO PIN 13
ADC_PW1 PIN 11
ADC_PW2 PIN 12
ADC_RESULT VAR Word
'######################################################################################
'######################################################################################
MAIN:
HIGH 0 'Power LED on this pin
GOSUB SET_AD
GOSUB READ_AD
GOSUB DISPLAY_IT
PAUSE 10
GOTO main
'######################################################################################
'######################################################################################
SET_AD:
'soon add offset allowing for the ability to zoom in on a temp for better resoluition
PWM ADC_PWM, 104, 255 '2v Vin(-)works good for now
PWM ADC_PW2, 75, 255 '1V Vref settings
RETURN
'######################################################################################
'######################################################################################
READ_AD:
LOW ADC_CS
SHIFTIN ADC_DO, ADC_CL, MSBPOST, [noparse][[/noparse]ADC_RESULT\9]
HIGH ADC_CS
RETURN
'######################################################################################
'######################################################################################
DISPLAY_IT:
DEBUG CLS, HOME, "TEMP IS-- " , DEC ADC_RESULT
RETURN
[noparse][[/noparse]\code]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Rick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Rick