I've set up a little program to try out adcin on 16f873A:
Why it gives me a range of values from 0 to 65535 (5V)?? Shouldn't be 1024?Code:DEFINE LCD_DREG PORTB ' LCD data port DEFINE LCD_DBIT 4 ' LCD data starting bit 0 or 4 DEFINE LCD_RSREG PORTB ' LCD register select port DEFINE LCD_RSBIT 0 ' LCD register select bit DEFINE LCD_EREG PORTB ' LCD enable port DEFINE LCD_EBIT 2 ' LCD enable bit DEFINE LCD_BITS 4 ' LCD bus size 4 or 8 DEFINE LCD_LINES 4 ' Number lines on LCD DEFINE LCD_COMMANDUS 2000 ' Command delay time in us DEFINE LCD_DATAUS 50 ' Data delay time in us DEFINE ADC_BITS 10 DEFINE ADC_CLOCK 3 DEFINE ADC_SAMPLEUS 50 input PORTA.0 ADCON1 = ADCON1= %10001111 DEFINE OSC 12 Acquisition var word Clr CON 1 Comm Con $FE Main: ADCIN 0, Acquisition lcdout comm, clr, dec acquisition PAUSE 100 goto Main
PS. Setting 8bit gives me 256 values as it should be.
Bookmarks