OK I'm going to throw this thing out the window in a moment
I downloaded a sample code from this forum written by Bruce
Code:ASM __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF endasm DEFINE ADC_BITS 10 DEFINE ADC_CLOCK 3 DEFINE ADC_SAMPLEUS 50 number VAR word 'CMCON = 7 ' Comparators off ANSEL = %00000001 ' GPIO.0 A/D in, rest digital ADCON0.7 = 1 ' Right justify for 10-bit GPIO = %00000000 ' Initialize outputs TRISIO = %00000001 ' GPIO.0 = input, rest outputs Tx var GPIO.5 main: adcin 0,number ' Read AN0 Serout2 Tx,84, ["val: ",#number,10] pause 5000 goto main
With the 10K pot wired between the supply with the wiper to GPIO.0 and get readings between 437 and 440 !!!!!!!!!!!!!! - still just three digits between min and max.
I had to rem out the CMCON line - presumably the 12F683 has no comparators, would that be the case.




Bookmarks