1246 views|0 replies

1663

Posts

0

Resources
The OP
 

msp430f5529 dual output pwm wave [Copy link]

#include <msp430.h>
extern unsigned int period,period1;
int pwm1(period,period1) adjust duty cycle
{

P2DIR |= BIT0+BIT5; // P2.0 and P2.1 output
P2SEL |= BIT0+BIT5; // P2.0 and P2.1 options select
TA1CCR0 = 1000-1; // PWM Period
TA2CCR0 = 1000-1;
TA1CCTL1 = OUTMOD_7; // CCR1 reset/set
TA1CCR1 = period; // CCR1 PWM duty cycle
TA2CCTL2 = OUTMOD_7; // CCR2 reset/set
TA2CCR2 = period1; // CCR2 PWM duty cycle
TA1CTL = TASSEL_1 + MC_1 + TACLR; // ACLK, up mode, clear TAR
TA2CTL = TASSEL_1 + MC_1 + TACLR;
__bis_SR_register(LPM3_bits); // Enter LPM3
__no_operation(); // For debugger
}

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