51
Code Example
#include <MSP430G2452.h>
unsigned char state = 0x00;
void BCSplus_graceInit(void);
void GPIO_graceInit(void);
void System_graceInit(void);
void WDTplus_graceInit(void);
#pragma vector=PORT1_VECTOR
__interrupt void PORT1_ISR_HOOK(void)
{
state = ~state;
P1OUT ^= BIT0;
P1IFG = 0x00;
}
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 MSP430 System Registers */
System_graceInit();
/* initialize Config for the MSP430 WDT+ */
WDTplus_graceInit();
do
{
P1OUT ^= BIT6;
if(state)
{
_delay_cycles(60000);
}
else
{
_delay_cycles(30000);
}
}while(1);
}
void BCSplus_graceInit(void)
{
/* USER CODE START (section: BCSplus_graceInit_prologue) */