142
Code Example
#include <msp430.h>
void GPIO_graceInit(void);
void BCSplus_graceInit(void);
void InterruptVectors_graceInit(void);
void System_graceInit(void);
void WDTplus_graceInit(void);
void main(void)
{
// Stop WDT+
WDTCTL = WDTPW + WDTHOLD; // Set hold bit and clear others
/* 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();
while(1)
{
P1OUT ^= BIT0;
_delay_cycles(60000);
WDTCTL = WDTPW | WDTCNTCL;
if((P1IN & BIT3) == !BIT3)
{
WDTCTL = WDTPW | WDTSSEL;
while(1)
{
P1OUT ^= BIT6;
_delay_cycles(45000);
};
}
}
}
void GPIO_graceInit(void)
{
/* USER CODE START (section: GPIO_graceInit_prologue) */
/* User initialization code */
/* USER CODE END (section: GPIO_graceInit_prologue) */
/* Port 1 Output Register */