Created
October 20, 2018 13:41
-
-
Save Ryanhu1015/de9a54c8c73baa6523ac36a63939983b to your computer and use it in GitHub Desktop.
embedded rookie
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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