4 Replies Latest reply on Apr 15, 2016 10:13 AM by user_78878863

    Trigger two PWM modules simultaneously

    user_418894472

      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

        • 1. Re: Trigger two PWM modules simultaneously
          user_14586677

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

             

           

             

          Regards, Dana.

          • 2. Re: Trigger two PWM modules simultaneously
            user_14586677

            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.

            • 3. Re: Trigger two PWM modules simultaneously
              user_418894472

              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);

              • 4. Re: Trigger two PWM modules simultaneously
                user_78878863

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