Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
embedded rookie
void ADC_Init(void);
void ADC_Init(){
P0M=0x38;// set I/O as input/output mode
P0CON |= 0x02;//let P01 as a pure analog pin
P0UR=0;// disable the pull-high
ADM=0x81;// enable ADC function, and use AIN1
ADR=0x60;// enable AIN channel, and set clock rate = fosc/1
VREFH=0x04;// ADC internal reference high voltage -> VDD
IEN0 |= 0x80;// enable global interrupt
//IEN2 |= 0x01;//ADC interrupt enable
ADM |= 0x40;//start ADC conversion
void ADC_ISR(void) interrupt ISRAdc{}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.