Hi,
Testing ADC code in MP lab is this possible??
Don't know it will work but it is according to data sheet ....
Testing ADC code in MP lab is this possible??
Don't know it will work but it is according to data sheet ....
Rich (BB code):
#include <htc.h>
__CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_HS);
#define _XTAL_FREQ 20000000
#define DAD PORTB
main(){
TRISB=0X00;
TRISA = 0xff ;
ADCON1=0b00000000;
ADCON0=0b10000001;//000 = channel 0, (RA0/AN0)
while(1){
ADIF=0;
ADIE=1;
PEIE=1;
GIE=1;
__delay_ms(1);
GO_DONE=1;
__delay_ms(1);
DAD=ADRESH;
}
}