160
Code Example
#include <msp430.h>
#include "delay.h"
void BCSplus_graceInit(void);
void GPIO_graceInit(void);
void Comparator_Aplus_graceInit(void);
void System_graceInit(void);
void WDTplus_graceInit(void);
#pragma vector=COMPARATORA_VECTOR
__interrupt void COMPARATORA_ISR_HOOK(void)
{
P1OUT ^= BIT0;
CACTL2 &= ~CAIFG;
}
void main(void)
{
/* Stop watchdog timer from timing out during initial start-up. */
WDTCTL = WDTPW | WDTHOLD;
/* initialize Config for the MSP430 GPIO */
GPIO_graceInit();
/* initialize Config for the MSP430 2xx family clock systems (BCS) */
BCSplus_graceInit();
/* initialize Config for the MSP430F2xx Comparator_A+ */
Comparator_Aplus_graceInit();
/* initialize Config for the MSP430 System Registers */
System_graceInit();
/* initialize Config for the MSP430 WDT+ */
WDTplus_graceInit();
while(1)
{
if (CACTL2 & CAOUT)
{
delay_ms(300);
}
if (!(CACTL2 & CAOUT))
{
delay_ms(100);
}
P1OUT ^= BIT6;
}
}
void BCSplus_graceInit(void)