Hi everyone,
I can't get my ADCs to working properly. I've tried to play with the registers, with no results.
I have to sample 4 analog inputs.
Only one reading is correct, it's the "tsense" refered to the ADCIN5. The others values displayed are completely crazy.
I'm using the PIC18F4431 ( datasheet : http://ww1.microchip.com/downloads/e...Doc/39616d.pdf )
The simple code used for the test :
Code:DEFINE OSC 32 DEFINE LCD_DREG PORTC DEFINE LCD_EREG PORTD DEFINE LCD_RSREG PORTD DEFINE LCD_EBIT 0 DEFINE LCD_RSBIT 1 DEFINE ADC_BITS 10 TRISA=%11111111 TRISB=%11000000 TRISC=%110000 TRISD=%11100 TRISE=%11111111 ANSEL0=%11111111 ADCON0=%00011111 ADCHS=%01010101 potsense var word tsense var word usense var word isense var word pause 2000 LCDOUT $fe,1 lp: ADCIN 4,potsense ADCIN 5,tsense ADCIN 6,usense ADCIN 7,isense lcdout $fe,$2,DEC5 potsense," ",DEC5 tsense lcdout $fe,$c0,DEC5 usense," ",DEC5 isense pause 10 goto lp




Bookmarks