Quantcast
Viewing all articles
Browse latest Browse all 63778

Forum Post: RE: Error in Timer

You did very well. My only comment is about one of your comments. You said: " _BIS_SR(GIE); //enter LPM0 with interrupt ". The comment there is not correct. By the way there is another clock source, VLOCLK , which is reliable but the frequency varies wildly from chip to chip and there is a strong dependence on operating voltage and temperature. Here is a slightly modified version of your code. #include void main(void){ BCSCTL3 = LFXT1S_2; //ACLK = VLO WDTCTL = WDTPW + WDTHOLD; //Stop Watchdog Timer P1DIR |= 0x41; //Setting P1.0 and P1.6 as output direction CCTL0 = CCIE; //Enable CCR0 interrupt CCR0 = 12000; //may need adjustments to get closer to 1 second TACTL = TASSEL_1 | MC_1; //ACLK/1, Up mode P1OUT = 0x40; //P1.6 on P1.0 off _BIS_SR(GIE|LPM3_bits); //enter LPM3 with interrupt while(1){ } } //timer A0 interrupt service routine #pragma vector=TIMER0_A0_VECTOR __interrupt void Timer_A(void){ P1OUT ^= 0x41; //flip both P1.6 and P1.0 }

Viewing all articles
Browse latest Browse all 63778

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>