1072 views|0 replies

1662

Posts

0

Resources
The OP
 

MSP430 timer controls PWM output [Copy link]

/*Timer output unit example: ACLK clock frequency is LFXT1=32768Hz, use Timer_A to output a PWM wave with a period of 512/32768 =15.625ms, and a duty cycle of 75% and 25% respectively */ #include "io430.h" int main( void ) { // Stop watchdog timer to prevent time out reset WDTCTL = WDTPW + WDTHOLD; TACTL=TASSEL_1+TACLR; CCR0=512-1;//PWM period CCTL1=OUTMOD_7; CCR1=384;//384/512=0.75 CCTL2=OUTMOD_7; CCR2=128;//Duty cycle 128/512=0.25 P1DIR|=BIT2; P 1SEL|=BIT2; P2DIR|=BIT0; P2SEL|=BIT0; TACTL|=MC_1;//Up counting mode while(1) { LPM3; } return 0; }

This post is from Microcontroller MCU
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list