1 Attachment(s)
Pic12f683, Trisio, High Z, A2d
Hello to all,
I have a little problem on the 12F683. I want to get the pin GPIO.0 to switch from a LOW state (GND) to a High impedence state (High Z) and while in High Z take an anolog to digital conversion at GPIO.4.
The problem with the current circuit and Code that i have (attached is a schematic and sample code) is that while in in the LOW State the A/D will be normal and read normal voltage. However, in the HIGH Z state the PIN GPIO.4 (or AN3) will jump to a HIGH state (i.e to VDD).
Does anyone have any suggestions on how I can go about achieving this task? Maybe another way of switching from High Z to Gnd? Any help would be greatly appreciated.
Sammple Code:
'Define ADCIN parameters
Define ADC_BITS 10 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
Define OSC 4 'define oscilator
Volt VAR WORD
main:
TRISIO = %010000 'Set GPIO.0 as OUTPUT
LOW GPIO.0 'GND STATE
Pause 5000
TRISIO = %010001 'Set GPIO.0 as input (HIGH Z State)
pause 4000
ADCIN 3, Volt
if Volt >= 970 then loop
pause 1000
goto main
loop:
goto main
END
Schematic Attached:
Thank You All!
Should have a closer look to your scheme ...
A good question would be How much are Va and Vb ...
probably more than the VDD supply of the pic ...
gave you some idea for debugging your Pic batt charger ???
Alain