Professional Documents
Culture Documents
Square Wave Generation
Square Wave Generation
h>
void configureClocks()
{
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
if (CALBC1_1MHZ != 0xFF)
{
DCOCTL = 0; // Select lowest DCOx and MODx
BCSCTL1 = CALBC1_1MHZ; // Set range
DCOCTL = CALDCO_1MHZ; // Set DCO step + modulation
}
}
void main(void)
{
configureClocks();
TACCR0 = 7;
TA0CTL |= TASSEL_1+ID_1+MC_1+TACLR;
TA0CTL |= TAIE;
P1DIR |= BIT0;
P1OUT &= ~BIT0;
__enable_interrupt();
LPM0;
}