How to generate PWM for 5 different voltage steps(or, duty cycles) in PSoC 4 CY8CKIT-042-BLE?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
AmMa_2724956
Level 2
Level 2
First like received

I am new on PSoC and I wanted to know how to generate PWM for 5 different voltage steps { like 20,40,60,80,100} (or, duty cycles) in PSoC 4 CY8CKIT-042-BLE?, I am using a 10KHz clock cycle, 16-bit resolution with a period of 10000 on a 16-bit UDB PWM

0 Likes
4 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

The duty cycle is (period / compare) * 100 in percent. So modifying the compare value only between 0 and 10000 will give you any value you need. There is an API to set the compare value.

Imho the input frequency should be a bit higher. As for now your period is 1s which seems quite too slow. I would suggest setting the input freq to 10MHz.

Bob

0 Likes

Can we generate 5 different duty cycles on single PWM? How?

0 Likes

You might want to use an RC circuit outside of the PSoC to convert a digital wave signal to an analog signal.

The RC circuit would filter the high frequency of the PWM, providing an almost constant voltage (you would see some small ripple, depending how big is the capacitor of the RC circuit).

If the PWM VDDIO is 3.3 V, you would get:

100% Duty Cycle -> 3.3 V

50% Duty Cycle ~ 1.65 V

0% Duty Cycle -> 0.0 V

You can refer to the Trim/Margin component in the Cypress Catalog. They use this technique to control power regulators.

0 Likes
AmMa_2724956
Level 2
Level 2
First like received

Can we generate 5 different duty cycles on single PWM? How?

0 Likes