Implementation of PWM in CY8C20x34 Devices - KBA215678

Version: *A

 

Question:

How do I implement a PWM in a CY8C20x34 device?

 

Answer:

CY8C20x34 lacks a dedicated hardware block that can generate a PWM output, but is equipped with a 13-bit timer, which can be used for this purpose.

The Timer13 user module is a 13-bit programmable timer clocked by the internal 32-kHz clock and has a provision for an interrupt callback.

Use the project attached with this article that demonstrates how Timer13 along with an interrupt callback can be used to generate two sample PWM outputs with adjustable periods and duty cycles. Note that this method uses interrupts; therefore, some amount of CPU is used for processing the interrupt to generate the PWM signal levels. This will limit the minimum period or maximum frequency of the PWM output.