109
Code Example
#include <msp430.h>
#include "delay.h"
void GPIO_graceInit(void);
void BCSplus_graceInit(void);
void Timer0_A3_graceInit(void);
void System_graceInit(void);
void WDTplus_graceInit(void);
void main(void)
{
unsigned int pwm_value = 0;
/* 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 A3 Timer0 */
Timer0_A3_graceInit();
/* initialize Config for the MSP430 System Registers */
System_graceInit();
/* initialize Config for the MSP430 WDT+ */
WDTplus_graceInit();
while(1)
{
for(pwm_value = 0; pwm_value < 1000; pwm_value++)
{
TA0CCR1 = pwm_value;
TA0CCR2 = pwm_value;
delay_ms(1);
}
for(pwm_value = 999; pwm_value > 0; pwm_value--)
{
TA0CCR1 = pwm_value;
TA0CCR2 = pwm_value;
delay_ms(1);
}
};
}
void GPIO_graceInit(void)
{
/* USER CODE START (section: GPIO_graceInit_prologue) */
/* User initialization code */
/* USER CODE END (section: GPIO_graceInit_prologue) */