[求助] 关于定时器中断

chuzhitian   2012-7-27 21:59 楼主
  1. #include "msp430g2553.h"

  2. void delay(void); // Software delay

  3. void main(void)

  4. {
  5. WDTCTL = WDTPW + WDTHOLD; // Stop WDT
  6. ADC10CTL1 = CONSEQ_2; // Repeat single channel
  7. ADC10CTL0 = REFOUT + REFON + MSC + ADC10ON;
  8. __enable_interrupt(); // Enable interrupts.
  9. TACCR0 = 30; // Delay to allow Ref to settle
  10. TACCTL0 |= CCIE; // Compare-mode interrupt.
  11. TACTL = TASSEL_2 | MC_1; // TACLK = SMCLK, Up mode.
  12. LPM0; // Wait for delay.
  13. TACCTL0 &= ~CCIE; // Disable timer Interrupt
  14. __disable_interrupt();
  15. ADC10AE0 |= 0x10; // P1.4 ADC option select
  16. P1DIR |= 0x08; // Set P1.3 output direction
  17. P1SEL |= 0x08; // Set P1.3 option select

  18. for (;;)

  19. {
  20. ADC10CTL0 &= ~ENC; // ADC10 disable
  21. ADC10CTL0 ^= REF2_5V; // Toggle Vref 1.5/2.5V
  22. ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
  23. delay();
  24. }
  25. }

  26. void delay(void)

  27. {
  28. volatile unsigned long i;
  29. for (i = 0x7FFFF; i > 0; i--);
  30. }

  31. #pragma vector=TIMER0_A0_VECTOR

  32. __interrupt void ta0_isr(void)
  33. {
  34. TACTL = 0;
  35. LPM0_EXIT; // Exit LPM0 on return
  36. }
各位大神看下,上面中断中TACTL = 0有什么用??为什么删掉也能运行??

回复评论 (1)

自己先顶下!
点赞  2012-7-28 13:52
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复