cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

MrMa_286121
New Contributor II

How to start two PWM modules simultaneously?

   

I came across the function TCPWM_TriggerCommand(mask, command). But I don't know how to feed in the parameters.

   

I have two PWM modules PWM1 and PWM2, please give an example to show the use of  TCPWM_TriggerCommand() function.

   

Thank you

0 Likes
Reply
4 Replies
ETRO_SSN583
Esteemed Contributor

Something like this, a write to control reg starts them.

   

 

   

Regards, Dana.

0 Likes
Reply
ETRO_SSN583
Esteemed Contributor

I see the command in the PWM_n.c file, but it is not descriptive enough to show how

   

to set up.

   

 

   

All else fails file a CASE and post back here results for benefit of forum.

   

 

   

To create a technical or issue case at Cypress -

   

 

   

www.cypress.com

   

“Support”

   

“Technical Support”

   

“Create a Case”

   

 

   

You have to be registered on Cypress web site first.

   

 

   

Regards, Dana.

0 Likes
Reply
MrMa_286121
New Contributor II

Hi!

   

I just learnt how to start several PWM modules simultaneously using the TCPWM_TriggerCommand() function. It's very easy!

   

1. Place several PWM components in the design and enable the external 'START'  terminal in the initial setting box.

   

2. Start all PWMs one by one using PWM_Start(). Note: this will only initialize the PWM blocks and will not start them because the external 'Start' terminal is present.

   

3. Now use the TCPWM_TriggerCommand() function to start all of them simultaneously.

   

Here is an example code with two PWM blocks.

   
    

    PWM_1_Start();
    PWM_2_Start();
    PWM_1_TriggerCommand(PWM_1_MASK|PWM_2_MASK, PWM_1_CMD_START);

   
   

Any instance of PWM can apply this command on any of the PWMs in the design. For example

   

instead of:   PWM_1_TriggerCommand(PWM_1_MASK | PWM_2_MASK, PWM_1_CMD_START);

   

we could use:  PWM_2_TriggerCommand(PWM_1_MASK | PWM_2_MASK, PWM_1_CMD_START);

0 Likes
Reply
HeLi_263931
Honored Contributor II

Oh, thats very nice. I need to remember this. Thanks!

0 Likes
Reply