I have the below code.
I use pic16f877a and work fine. When i use the pic16f88 the code is not work.Why;
Code:' Define ADCIN parameters DEFINE ADC_BITS 10 ' Set number of bits in result DEFINE ADC_CLOCK 3 ' Set clock source (3=rc) DEFINE ADC_SAMPLEUS 50 ' Set sampling time in uS adval VAR WORD ' Create adval to store result ANSEL = %00000001 'this added for pic16f88 CMCON = 7 ' Turn off the comparator ADCON0 = %11100001 ' Configure and turn on A/D Module ADCON1 = %10000010 ' Port A is analog TRISA = %11111111 ' Set PORTA to all input INCLUDE "LCDbar_INC.bas" ' Include the BARgraph routines loop: ADCIN 0, adval ' Read channel 0 to adval (0-1023) adval = (adval */ 500)>>2 ' equates to: (adval * 500)/1024 LCDOut $fe,1 @ BARgraph _adval, 1, 0, 16, 100, lines PAUSE 200 GoTo loop ' Do it forever





Bookmarks