Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
I had some questions regarding the implementation of two PWM blocks in parallel.. It’s a simple implementation.This my first time with PSOC 5LP.
I know how to enable a PWM block using “PWM_1_Start();” in the “main.h” file but when I’m using the second PWM block then its giving an error with the “PWM_2_Start();” command. I read somewhere that I have to enable a control register somewhere but cant figure out where to do it.
I just need to enable two PWM block synchronously at a fixed frequency and 50% duty cycle.
There are (at least) two ways to synchronize the PWM signals with the PSoC 5LP.
1. In case same resolution and clock may be used, then you can select the "PWM MODE: Two Outputs" in the PWM block configuration. By doing this you will get a single PWM timer (and two independent PWM signals), which is started with a single PWM_1_Start(), I am not quite sure though why you would need two PWM blocks, if the PWM signals are equal.
2. In case the two PWM signals are completely different (e. g. different frequency for 50%), but you want initial synchronization of counters, then you can use the UDB implementation of the each of two PWM blocks, and select the "Trigger Mode" at the Advanced options. For the SW synchronizaton for instance select the single bit Control Register and connect to the PWM trigger signals. You also need to select the "Enable mode: SW only" for the PWM blocks under Advanced options. The PWM counters will fire off once you set the Controller Register bit (and not after you previously called the PWM_1_Start() & PWM_2_Start()).
All mentioned SW calls for this simple implementation should be done before the for(;;) loop inside the main.c.