Created
March 4, 2013 14:51
-
-
Save WideWord/5082739 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "msp430g2231.h" | |
| void main(void) { | |
| WDTCTL = WDTPW + WDTHOLD; | |
| P1DIR |= BIT5; | |
| P1OUT = 0; | |
| TACCR0 = 1000; | |
| TACCTL0 = CCIE; // enable interrupt | |
| TACTL = TASSEL_2 | ID_0 | MC_1 | TACLR; // timer settings | |
| _enable_interrupt(); | |
| while (1) { | |
| } | |
| } | |
| int value = 0; | |
| #pragma vector = TIMERA0_VECTOR | |
| __interrupt void CCR0_ISR(void) { | |
| if (value == 0) P1OUT |= BIT5; else P1OUT &= ~BIT5; | |
| value = ~value; | |
| } // CCR0_ISR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment