WDTCTL = WDTPW + WDTHOLD; // Stop watchdog
ADC10CTL1 = ADC10DIV_3 + INCH_10 + SHS_1 + CONSEQ_2; // TA trig., rpt, A10
ADC10CTL0 = SREF_1 + ADC10SHT_3 + REF2_5V + ADC10IE + REFON + ADC10ON;
__enable_interrupt(); // Enable interrupts.
TACCR0 = 30; // Delay to allow Ref to settle
TACCTL0 |= CCIE; // Compare-mode interrupt.
TACTL = TASSEL_2 | MC_1; // TACLK = SMCLK, Up mode.
LPM0; // Wait for delay.
TACCTL0 &= ~CCIE; // Disable timer Interrupt
__disable_interrupt();
ADC10CTL0 |= ENC;
TACCTL1 = OUTMOD_4; // Toggle on EQU1 (TAR = 0)
TACTL = TASSEL_2 + MC_2; // SMCLK, cont-mode
while (!(ADC10IFG & ADC10CTL0)); // First conversion?
FirstADCVal = ADC10MEM; // Read out 1st ADC value
P1OUT = 0x00; // Clear P1
P1DIR = 0x01; // P1.0 as output
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0 w/ interrupt
}
#pragma vector=ADC10_VECTOR
__interrupt void ADC10_ISR (void)
{
if (ADC10MEM >= FirstADCVal + ADCDeltaOn)
P1OUT |= 0x01; // LED on
else
P1OUT &= ~0x01; // LED off
}
程序贴在上面,我的疑问有以下几个,求解答
1.程序中使用的是TimerA做为采样触发输入源,并且使用的输出模式是OUTMOD_4,在这个程序中,这个模式输出的是不是周期为65535x2的方波(占空比为50%)?
2.AD10什么时候开始采样,是在1问中方波的上升沿还是下降沿?
求大神解答,谢谢啦~
此帖出自
小平头技术问答
一周热门 更多>