|
4芯积分
我用MSP430f5529做ADC采样,为什么ADC12MEM0中一直没有输出啊?路过大神麻烦这边看
int main(void)
{
volatile unsigned int i;
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P6SEL |= 0x01; // Enable A/D channel A0
P1DIR |= BIT0;
P6DIR |= BIT0;
REFCTL0 &= ~REFMSTR; // Reset REFMSTR to hand over control to
// ADC12_A ref control registers
ADC12CTL0 = ADC12ON+ADC12SHT02+ADC12REFON+ADC12REF2_5V;
// Turn on ADC12, Sampling time
// On Reference Generator and set to
// 2.5V
ADC12CTL1 = ADC12SHP; // Use sampling timer
ADC12MCTL0 = ADC12SREF_1; // Vr+=Vref+ and Vr-=AVss
for ( i=0; i<0x30; i++); // Delay for reference start-up
Ini_Lcd();
Disp_HZ(0x80,hang1,3);
ADC12CTL0 |= ADC12ENC; // Enable conversions
while (1)
{
ADC12CTL0 |= ADC12SC; // Start conversion
while (!(ADC12IFG & BIT0));
// __no_operation(); // SET BREAKPOINT HERE
if(ADC12MEM0!=0)
{
P1OUT ^= BIT0;
for(k=0;k<10;k++);
}
// result = ADC12MEM0;
adc12();
}
}
后面的adc12();是一个显示函数;麻烦帮我看一下吧!各位大神,万分感谢
|
|