Video based Tutorial for Timer in Compare mode is available on My YouTube Channel: https://youtu.be/Drisf7VQI60
Please Subscribe to the Channel!
Code:
#include <msp430g2553.h>
void main(void)
{
WDTCTL = WDTPW +
WDTHOLD; // Stop WDT
P1DIR |= 0x40; // P1.6 output
CCTL0 = CCIE; // CCR0 interrupt
enabled
CCR0 = 65000;
TACTL = TASSEL_2 +
MC_1; // SMCLK, upmode
_BIS_SR(LPM0_bits +
GIE); // Enter LPM0 w/
interrupt
}
// Timer A0 interrupt service routine - CCR0 vector
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer_A (void)
{
P1OUT ^= 0x40; // Toggle P1.6
}
thank you it's interesting
ReplyDelete