hi everyone, I am using a pic16f877 @ 20Mhz. what i am trying to do here is let the timer1 run and when it overflows load the ADC value just converted, then let the timr time out and then reload again...
I have loaded values into the timer to allow for faster overflow as per my requirements.
whats happening now is that we i input only 0.2v on the analogue pin the timer overflows.. I would expect it to overflow steadily from 0-5v for a 10 bit adc result..
any ideas?
here is the code..
#include <pic.h> #include <delay.h>
__CONFIG(WDTDIS);
#define clear 0 #define on 1 #define off 0 #define time_l 0x00 #define time_h 0xFB bit done;
INTCON = 0xC0; // GIE and PEIE enabled TRISA = 0b00000010; // set port to input TRISB = 0b00000000; // set port to output PIE1 = 0x41; // ADIE, TMR1IE enabled PIR1 = 0x01; // TMR1IF enabled }