A few things strike me here...
1. Why are you setting ANSEL=0 (Analog Inputs to OFF) and then using ADCIN for Analog Input? Surely you would set ANSEL for Analog per your requirements. This might cause you some anomalies.
2. There are four ADC inputs on the 12F675, but wouldn't you access the fourth one as ADCIN3 (counting up from zero) rather than ADCIN4.
3. The pause turning GPIO.4 Low is only 100mS, (compared up to 5 Seconds High) does it actually happen but you haven't noticed and it gets turned on again immediately?
4. And do set TRISIO to Output for GPIO.4...
Bookmarks