Anyone Got a 16F88 to Work in Analog?
Has anyone got a 16F88 to work in analog at all? I am dead in the water right now. It appears to set the registers ok but I am not getting anything that tells me its working. If anyone has something that works please let me know or otherwise I guess I go back to a 16F876 and see if I can get that to work, but it cost more....
Brian R.
16F88 Analog input problem
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.