程序内容:RTC
、LCD
显示、ADC
电池采样;MSP430FR4133
可以做到7UA
,MSP430FR6972
却有40UA
;多余的电流经查ADC
(10UA
),AD
关闭,内部参考电压无法关闭而MSP430FR4133
可以关闭,为什么?void ADC12_Config() // MSP430FR6972{ PMMCTL0= SVSHE + PMMPW; while(REFCTL0& REFGENBUSY); // If refgenerator busy, WAIT REFCTL0 |= REFVSEL_1 + REFON; // Enable internal 2.0V reference //
参考电压配置 ADC12CTL0 &= ~ADC12ENC; // Disable ADC12 (
在ADC12ENC=0
的情况下,修改启动或关闭AD) ADC12CTL0 = ADC12SHT0_8 + ADC12ON; // Set sample time
采样保持时间 256ADCCLK
;启动AD ADC12CTL1 = ADC12SHP; // Enable sample timer ADCCLK = MODOSC; sampling timer
: 从采样保持器中获取信号 ADC12CTL2 |= ADC12RES_2; // 12-bit conversion results
分辨率 ADC12CTL3 = ADC12BATMAP; // Enable internal 1/2 AVCC+ ADC12MCTL0 = ADC12VRSEL_1 + ADC12INCH_31; // ADC input ch A30 =>internal 1/2 AVCC+ ADC12IER0 |= ADC12IE0; // ADC_IFG upon convresult-ADCMEMO while(!(REFCTL0 & REFGENRDY)); // Wait for reference generator //to settle ADC12CTL0 |= ADC12ENC; __delay_cycles(400);}ADC
中断 case ADC12IV_ADC12IFG0: // Vector 12: ADC12MEM0 Interrupt ui16Bat_Vol = (uint32_t)100*ADC12MEM0/0x3FF; if(ui16Bat_Vol_Old!=ui16Bat_Vol) { bADC_done_flag= true; ui16Bat_Vol_Old= ui16Bat_Vol; } //Exit from LPM0 and continue executing main while(REFCTL0 & REFGENBUSY); // If ref generator busy, WAIT REFCTL0 = 0; while(!(REFCTL0 & REFGENRDY)); // Wait for reference generator ADC12CTL0 &= ~ADC12ENC; ADC12CTL0 &= ~ADC12ON; //AD
关闭 break;
此帖出自
小平头技术问答
ADC问题已经解决
一周热门 更多>