|
想用MSP430F5529LP的ADC 但是采样频率一直很低。希望有大神指点一下,提高采样频率。代码如下:
P5SEL |= BIT2+BIT3;
UCSCTL6 &= ~XT2OFF;
UCSCTL3 |= SELREF_2;
UCSCTL4 |= SELA_2;
do
{
UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG);
// Clear XT2,XT1,DCO fault flags
SFRIFG1 &= ~OFIFG; // Clear fault flags
}while (SFRIFG1&OFIFG); // Test oscillator fault flag
UCSCTL6 &= ~XT2DRIVE0; // Decrease XT2 Drive according to
// expected frequency
UCSCTL4 |= SELS__XT2CLK + SELM__XT2CLK;
P6SEL |= BIT0;
P6SEL |= BIT1;
REFCTL0 &= ~REFMSTR;
ADC12CTL0 |= ADC12SHT00+ADC12ON+ADC12REFON+ADC12REF2_5V+ADC12MSC;
ADC12MCTL0 |= ADC12SREF_1+ADC12INCH0;
ADC12CTL1 |= ADC12SHP+ADC12SHS1+ADC12CONSEQ_3;
ADC12IE |=ADC12IE0;
ADC12CTL0 |= ADC12ENC;
希望采样周期再40微秒以内
|
|