Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <msp430.h>
- int main(void)
- {
- WDTCTL = WDTPW | WDTHOLD; // Stop WDT
- // Configure GPIO
- P6DIR |= BIT6; // P1.0 output
- P6OUT |= BIT6; // P1.0 high
- P4OUT |= BIT1; // Configure P1.3 as pulled-up
- P4REN |= BIT1; // P1.3 pull-up register enable
- P4IES |= BIT1; // P1.3 Hi/Low edge
- P4IE |= BIT1; // P1.3 interrupt enabled
- // Disable the GPIO power-on default high-impedance mode to activate
- // previously configured port settings
- PM5CTL0 &= ~LOCKLPM5;
- P4IFG &= ~BIT1; // P1.3 IFG cleared
- TB0CCTL0 |= CCIE; // TBCCR0 interrupt enabled
- TB0CCR0 = 25600;
- TB0CTL = TBSSEL__ACLK | MC__UP; // ACLK, UP mode
- __bis_SR_register(LPM0_bits | GIE); // Enter LPM0 w/ interrupt
- __no_operation(); // For debug
- }
- // Timer0_B0 interrupt service routine
- #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
- #pragma vector = TIMER0_B0_VECTOR
- __interrupt void Timer0_B0_ISR (void)
- #elif defined(__GNUC__)
- void __attribute__ ((interrupt(TIMER0_B0_VECTOR))) Timer0_B0_ISR (void)
- #else
- #error Compiler not supported!
- #endif
- {
- P6OUT ^= BIT6;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement