程序内容: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;
此帖出自
小平头技术问答
VSS--4.7uF -| R23/LCDCAP
VSS--0.1uF -|R03
VSS--0.1uF -|R13
VSS--0.1uF -|R23
程序设置有错吗?
void CLOCK_Config() // MSP430FR6972
{
PJSEL0 = BIT4 | BIT5; // For LFXT
// Configure LFXT 32kHz crystal
CSCTL0_H = CSKEY >> 8; // Unlock CS registers
CSCTL4 &= ~LFXTOFF; // Enable LFXT
do
{
CSCTL5 &= ~LFXTOFFG; // Clear LFXT fault flag 清除 LFXT 失效标志
SFRIFG1 &= ~OFIFG;
} while (SFRIFG1 & OFIFG); // Test oscillator fault flag 如果失效标志存在
CSCTL0_H = 0; // Lock CS registers
}
void LCD_Config(void) // MSP430FR6972
{
//Initialize LCD segments 0 - 15; 18 - 21; 24 ; 28 - 30
LCDCPCTL0 = 0xFFFF;
LCDCPCTL1 = 0x713C;
LCDCPCTL2 = 0x0000; //设置LCD管脚 L0 - L15; L18 - L21; L24 ; 28 - 30 pins selected
// Initialize LCD_C
// ACLK, Divider = 1, Pre-divider = 16; 4-pin MUX
LCDCCTL0 = LCDDIV__1 | LCDPRE__16 | LCD4MUX | LCDLP;
// VLCD generated internally,
// V2-V4 generated internally, v5 to ground
// Set VLCD voltage to 2.60v
// Enable charge pump and select internal reference for it
LCDCVCTL = VLCD_2_96 | VLCDREF_0 | LCDCPEN;
LCDCCPCTL = LCDCPCLKSYNC; // Clock synchronization enabled
LCDCMEMCTL = LCDCLRM; // Clear LCD memory
//Turn LCD on
LCDCCTL0 |= LCDON; // 打开LCD
}
一周热门 更多>