Skip to content

Instantly share code, notes, and snippets.

@WideWord
Created March 4, 2013 14:51
Show Gist options
  • Select an option

  • Save WideWord/5082739 to your computer and use it in GitHub Desktop.

Select an option

Save WideWord/5082739 to your computer and use it in GitHub Desktop.
#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