HI
I am using a 10f222 to monitor the value of a throttle position sensor (TPS).
0%-100%
When the 10F222 is not connected to the TPS, the TPS output is 4.00-2.18v
When the 10F222 is not connected to the TPS, the GPIO.0 has 3.9V
When the 10F222 is connected to the TPS, the TPS output is 3.99-3.89v.
So I don't know why GPIO.0 has 3.9v on it. When I do a debug, I can see the voltage, around 200 counts. Thats around 4v. What flag am I missing?
@ Device PIC10F222, IOFSCS_4MHZ, MCPU_OFF, WDT_OFF, PROTECT_OFF, MCLR_OFF
OPTION_REG.5=0
ADCON0 = 0
TRISIO =0
GPIO = 0
DEFINE DEBUG_REG GPIO 'SET DEBUG PIN PORT
DEFINE DEBUG_BIT 2 'SET DEBUG PIN BIT
DEFINE DEBUG_BAUD 9600 'SET DEBUG BAUD RATE
DEFINE DEBUG_MODE 1 'SET DEBUG MODE 0=TRUE / 1=INVERTED
Define ADC_BITS 8 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
CR CON 13 'constant for carriage return
Throttle var word 'Stores ADC value
IRQ var GPIO.1 'Output for throttle state
Start:
ADCIN 0, Throttle
debug "Throttle = ", # Throttle ,13
If Throttle < 200 then
low IRQ
else
high IRQ
Endif
goto start
Bookmarks