01.#include <msp430x14x.h>
02.
03.
04.
05.
06.void main(void)
07.{
08. WDTCTL = WDTPW +WDTHOLD; // Stop WDT
09. TACTL = TASSEL1 + TACLR; // SMCLK, Clear Tar
10. CCR0 = 512-1; // PWM Period = 488uS
11. CCTL1 = OUTMOD_7; // CCR1 reset/set
12. CCR1 = 256; // CCR1 PWM duty cycle
13. CCTL2 = OUTMOD_7; // CCR2 reset/set
14. CCR2 = 128; // CCR2 PWM duty cycle
15. P1DIR |= 0x04; // P1.2 output
16. P1SEL |= 0x04; // P1.2 TA1 option
17.
18. P2DIR |= 0x01; // P2.0 output
19. P2SEL |= 0x01; // P2.0 TA2 otion
20. TACTL |= MC0; // Start Timer_A in up mode
21.
22. for (;;)
23. {
24. _BIS_SR(CPUOFF); // Enter LPM0
25. _NOP(); // Required only for C-spy
26. }
27.} |