daothanhhoa993
Thành Viên PIF
Code:
#include <msp430g2553.h>
void main()
{
WDTCTL = WDTHOLD + WDTPW; // Stop watchdog timer
P2DIR |= BIT6; // Chon chuc nang TA0.1 cho chan P1.6
P2SEL &= ~BIT6;
P2SEL2 &= ~BIT6;
// Setup timer1
while(1)
{
TA0CTL |= TASSEL_0 + MC_1;
TA0CCTL1 = OUTMOD_3;
TA0CCR0 = 1000;
TA0CCR1 = 1000;
__delay_cycles(700000);
TA0CCR1 = 600;
__delay_cycles(700000);
TA0CCR1 = 400;
__delay_cycles(700000);
TA0CCR1 = 0;
_bis_SR_register(LPM0_bits);
}
}