Jump to content
Sign in to follow this  
chulen

Different Duty Cycle Clocks

Recommended Posts

Hi all, this is my first post in this forum. I am new to C programming and I managed to produce a variable frequency - variable duty cycle. I did it with the following code.

 

#include 

void main(void)
{
WDTCTL = WDTPW + WDTHOLD;  	// Stop WDT

BCSCTL1 = CALBC1_16MHZ;     // Set DCO to 16MHz
DCOCTL  = CALDCO_16MHZ;

P1DIR |= BIT2;             	// P1.2 to output
P1SEL |= BIT2;             	// P1.2 to TA0.1

CCR0 = 16-1;             	// PWM Period
CCTL1 = OUTMOD_7;          	// CCR1 reset/set
CCR1 = 1;                	// CCR1 PWM duty cycle
TACTL = TASSEL_2 + MC_1;   	// SMCLK, up mode

_BIS_SR(LPM0_bits);        	// Enter LPM0
}

 

However, I can't understand how to produce different duty cycle in different ends (same frequency). I will need about 5 different duty cycles.

Any ideas on how to solve this? Thanks in advance.

Share this post


Link to post
Share on other sites

Hi again.

 

I'm having trouble with my MSP430G2553, as I want to have 6 different outputs. They all have to work at the same frequency, but the times at which they are on are different.

 

For instance, what I want is described in the attachment.

 

Is this possible? I have read that there are three registers for Timer A, but I have read that there are more timers such as Timer A1, and Timer B. Can I use these? If not, is there any possible way to get six signals out of the MSP?

 

Thanks a lot for your time.

post-45211-135135571152_thumb.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...