Hi,
As far as I can see from reading the datasheet everything is controled by the ADCON0 register. Here's my untested shot at it:
Code:
Result var BYTE
TRIS = %00000001 'Set GP0 Input, rest as outputs.
ADCON0.7 = 0 'Set GP1 as digital
ADCON0.6 = 1 'Set GP0 as analog
ADCON0.0 = 1 'Turn ADC module ON
ADConvert:
ADCON0.3 = 0
ADCON0.2 = 0 'Select AN0 for covertsion.
ADCON0.1 = 1 'Start conversion.
While ADCON0.1 = 1 'ADCON0.1 will be reset when conversion is done
WEND 'so lets wait here 'till then.
Result = ADRES 'Store result.
Toggle GPIO.1 'Or whatever.....
Pause 250
Goto ADConvert 'Do it again.
May work, may not, have a look at section 7.0 in the datasheet.
/Henrik Olsson.
Bookmarks