#include <MC9S08AW60.h>
void ADC_Init(void)
{
/* ### Init_ADC init code */
/* APCTL2: ADPC15=0,ADPC14=0,ADPC13=0,ADPC12=0,ADPC11=0,ADPC10=0,ADPC9=0,ADPC8=1 */
APCTL2 = 0x01;
/* AD1SC2: ADACT=0,ADTRG=0,ACFE=0,ACFGT=0 */
AD1SC2 = 0x00;
/* AD1CV: ADCV9=0,ADCV8=0,ADCV7=0,ADCV6=0,ADCV5=0,ADCV4=0,ADCV3=0,ADCV2=0,ADCV1=0,ADCV0=0 */
AD1CV = 0x00;
/* AD1CFG: ADLPC=0,ADIV1=0,ADIV0=0,ADLSMP=0,MODE1=0,MODE0=0,ADICLK1=0,ADICLK0=0 */
AD1CFG = 0x00;
/* AD1SC1: COCO=0,AIEN=1,ADCO=1,ADCH4=0,ADCH3=1,ADCH2=0,ADCH1=0,ADCH0=0 */
AD1SC1 = 0x68;
}
byte AD_Value;
interrupt 23 void isrADC(void)
{
PTFD = AD1RL;
AD_Value = AD1RL;
}
|