Implementation of PWM in CY8C20x34 Devices - KBA215678

Version: **

 

Question:

How to implement a PWM in CY8C20x34 devices?

 

Answer:

The 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 call back. The project attached with this KB article demonstrates how Timer13 along with interrupt callback can be used to generate two sample PWM outputs with adjustable periods and duty cycles. Note that this method uses interrupts and hence 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.