I am trying simple code, I thought anyway....
Take a look at this....
DEFINE LOADER_USED 1
OSCCON = %01100111
TRISA = %00000011
TRISB = %00000000
PORTB = %00000000
ANSEL = %00000011
ADCON1 = %11000000
ADCON0 = %11000001
CMCON = 7
DEFINE ADC_BITS 8
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
CTA VAR BYTE
main:
ADCIN 0, CTA
ledtst1:
IF CTA > 50 Then tst2
PORTB = %00000001
GoTo cont
tst2:
IF CTA > 100 Then tst3
PORTB = %00000011
GoTo cont
tst3:
IF CTA > 175 Then tst4
PORTB = %00000111
GoTo cont
tst4:
PORTB = %00001111
cont:
Pause 200
GoTo main
End
Just something to give me a visual that I am getting something back. Unfortunately, unlike the 16F877A I don't have a display on this one to be able to read out the value....
Brian R.
Bookmarks