You are here

How Many PWM Outputs Can a PSoC 3 or 5 Generate? | Cypress Semiconductor

How Many PWM Outputs Can a PSoC 3 or 5 Generate?

An interesting question that I've gotten several times is how many instances of a specific function can be placed into a PSoC 3 or 5.  This question is particularly interesting for PSoC since unlike typical microcontroller alternatives, the quantity of a specific digital function that is present in a PSoC isn't a fixed small number.  If your application demands that the entire programmable digital array be used for just one function type, then you have that option.

Specifically it can be interesting to look at how many PWM outputs can be generated by a single PSoC 3 device.  The digital array (UDB array) has 24 UDBs.  Each of those UDBs can be used to create an 8-bit PWM.  Each of those PWMs can generate 2 independent outputs.  They have the same period, but the duty cycle is independent.  So if the entire array is dedicated to generating PWM outputs, then 48 PWM outputs can be generated.  To make sure there aren't any gotchas, the video shows a design that includes 48 PWM outputs along with the utilization report showing the resources used.  If by chance, 48 PWM outputs is not enough you can squeeze 4 additional PWM outputs from the fixed function counter/timer/PWM blocks.  I've not used those in the designs shown here, but they are available and can be used to provide 4 extra single output PWMs.  So the correct answer to the question posed by this post is 52.

The next question is what to do with all of these PWM outputs.  There are many real world examples where a large number of signals that have individually controllable PWM signals would be useful.  For this example I'm going to use them to control the brightness of LEDs.  In particular I've built a design that uses RGB LEDs, so I'll need 3 PWM outputs for each LED in order to control the three color components.  This will allow the creation of 16 Million possible colors since each of the color components can take on 256 distinct levels of brightness.  I didn't want to breadboard up a system with 16 of these LEDs, so to prove the concept I've used just 2 of the RGB LEDs.  To make it a little more interesting I've used the CapSense capability of PSoC to control the LEDs.  I'm using the 2 CapSense buttons on the DVK to select the LED and the color component and then using the slider to control the brightness.  Have a look at the video:

 

If you'd like to experiment with this design, you can download it here: RGB_LED Design

Comments

monox's picture

hello friend, I have a doubt as to modify the records of a PWM CMP 1 a SAR ADC using a poteniometro. I am working with the PSoC First Touch CY8C5588AXI thank you very much in advance

bjbu's picture

monox: I need a little more guidance on what you are wanting to do. Am I reading correctly that you want to change the duty cycle of the PWM based on the value that you read from the SAR ADC? I'm going to assume that you are using the UDB version of the PWM and that you want to change the duty cycle. In this case you would read the value from the SAR ADC, make some calculation based on that value and then write the value to the compare register using the PWM_1_WriteCompare1() function (note PWM_1 should be replaced with the instance name of your PWM).

ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.