while(1) { if (time_10ms) {ADCCON1|=0X30; /* clock divider */ ADCCON2|=0X0E; /* AQT time */ AUXR1|=SET_BIT4; /* ADC clock low speed */ clr_ADCCON0_ADCF; set_ADCCON0_ADCS; LowBat_V = (ADCRH<<4)+(ADCRL&0x0F); if (LowBat_V>=1280+40) //1320=3.5V 43.33=0.1V 1025/1280 { //Led_Mode=1; //P10=0; P11=1; } else if (1140<LowBat_V<1280) //1320=3.5V 43.33=0.1V { //Led_Mode=3; //P10=1; P11=0; }
}
|