Pardon the newbie question. I was searching and never came across an answer that I understood to this question. For reference, I am working with a 10F222 chip running at 5V Vdd.
If I read in a voltage using ADCIN from gpio.0, and store that value as a byte variable, I am trying to figure out what that value will be for various voltages at the gpio.0 pin.
Specifically, the voltage will vary. slowly, from 2.5VDC to 0.7VDC before the pic shuts down due to the boost regulator not being able to take in anything lower than 0.7VDC and convert to 5VDC to drive the pic.
This is the chunk of code I am curious about. One of my friends tossed me the front end information to get me started (and so I can hopefully figure it out).
@ device pic10F222, iofscs_8mhz, wdt_on, mclr_off, protect_off
ADCON0 = 0 'better disable the A/D module so PBP can config it right
osccal = %00000000 'turn off clockout!
OPTION_REG = %00000000 'bit5 is critical here for GPIO.2 TOCS = FOSC/4 I don't yet understand this one either....
DEFINE OSC 8 '8MHz
DEFINE ADC_BITS 8 ' set adcin to 8 bit
Vin var BYTE
gpio.0 = 1 'this is the a/d input
ADCIN 0,Vin
and if Vin in real life is 2.5V, 1V, or 0.7V... how do I figure out what value will get placed in the Vin variable?
thanks a lot
Greg
Bookmarks