|
-
#include "msp430g2553.h"
void delay(void); // Software delay
void main(void)
- {
- WDTCTL = WDTPW + WDTHOLD; // Stop WDT
- ADC10CTL1 = CONSEQ_2; // Repeat single channel
- ADC10CTL0 = REFOUT + REFON + MSC + 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();
- ADC10AE0 |= 0x10; // P1.4 ADC option select
- P1DIR |= 0x08; // Set P1.3 output direction
- P1SEL |= 0x08; // Set P1.3 option select
for (;;)
- {
- ADC10CTL0 &= ~ENC; // ADC10 disable
- ADC10CTL0 ^= REF2_5V; // Toggle Vref 1.5/2.5V
- ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
- delay();
- }
- }
void delay(void)
- {
- volatile unsigned long i;
- for (i = 0x7FFFF; i > 0; i--);
- }
#pragma vector=TIMER0_A0_VECTOR
- __interrupt void ta0_isr(void)
- {
- TACTL = 0;
- LPM0_EXIT; // Exit LPM0 on return
- }
-
复制代码 各位大神看下,上面中断中TACTL = 0有什么用??为什么删掉也能运行??
|
|