I'm working on same job but using a 16F88
i spend hours becaus a got garbagge on serial output
I find a solution
Increase define char_pacing !
by the way I have a problem .... value are not stable
one unit less .. one unit more ... input is done with two resistors !
quite strange ...
here is my poor job !
' program to display result of 10-bit A/D conversion on LCD
' Connect analog input to channel-0 (RA0)
adval var word
advalcd var word
advalcomp var word
DEFINE CHAR_PACING 1000
' Definition des parametres ADCIN
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
TRISA = %00000001 ' Set PORTA to all input
ADCON1 = %10000000 ' Set PORTA analog and right justify result
Pause 500 ' Wait .5 second
loop: ADCIN 0, adval ' Read channel 0 to adval
adval.highbyte = ADRESH 'HIGH byte of result to adval
adval.lowbyte = ADRESL 'LOW byte of result to adval
Lcdout $fe, 1 'nettoyage ecran
Lcdout "ADVAL ", #adval 'Affichage de la valeur en decimal
serout porta.3,N9600,["Position = ",#advalcd," Degres "]
pause 500
Goto loop 'Do it forever
End
Bookmarks