void Init_ADC()
{
P6SEL = 0x07;
P6DIR &= ~BIT0;
P6DIR &= ~BIT1;
P6DIR &= ~BIT2;
P6DIR &= ~BIT3;
ADC12CTL0 &= ~(ENC);
ADC12CTL1 |= CSTARTADD_0;
ADC12MCTL0 = INCH_0;
ADC12MCTL1 = INCH_1;
ADC12MCTL2 = INCH_2;
ADC12MCTL3 = INCH_3 + EOS;
ADC12CTL0 |= ADC12ON;
ADC12CTL0 |= MSC;
ADC12CTL1 |= CONSEQ_1;
ADC12CTL1 |= ADC12SSEL_1;
ADC12CTL1 |= ADC12DIV_0;
ADC12CTL1 |= (SHP);
ADC12CTL0 |= ENC;
return;
}
void Init_TimerA()
{
TACTL = TASSEL1 + TACLR;
CCTL0 = CCIE;
CCR0 = 40000;
TACTL |= MC0;
}
#pragma vector = TIMERA0_VECTOR
__interrupt void TimerA_ISR(void)
{
int results[4] = {0};
uchar SendL, SendH;
ADC12CTL0 &= ~ENC;
results[0] = ADC12MEM0;
// ADC12MEM1 = 0x0E0D;
results[1] = ADC12MEM1;
SendL = results[1] % 256;
SendH = results[1] >> 8;
Uart0_Send(SendH);
Uart0_Send(SendL);
Uart0_Send(0xEE);
results[2] = ADC12MEM2;
results[3] = ADC12MEM3;
ADC12MEM1 = 0x0000;
ADC12CTL0 |= ENC + ADC12SC;
}
新写了一段定时器触发的程序,这样是否能证明AD挂掉了?
收到的数据 一直是 00 00.
|