How to Make PWM Frequency Converter

by GreenPAK™ in Circuits > Electronics

25 Views, 0 Favorites, 0 Comments

How to Make PWM Frequency Converter

cover.jpg

The following design can convert a PWM signal from one known constant frequency to another constant frequency while retaining the duty cycle. This can be useful in cases where we want transmit the information contained in the duty cycle of a signal, over a carrier of different frequency. An example application is PWM control to analog output by means of RC filter - a low frequency PWM need a very large RC filter, but by converting the PWM to a higher frequency, a smaller RC filter can be used, along with advantages of smaller ripple and faster response.

Below we described steps needed understand how the solution has been programmed to create the PWM frequency converter. However, if you just want to get the result of programming, download GreenPAK software to view the already completed GreenPAK Design File. Plug the GreenPAK Development Kit to your computer and hit program to create the PWM frequency converter.

How It Works?

fig1.jpg

Let’s see how it works. When PIN#3 (signal input) goes HIGH, FSM1 is reset by the rising edge and starts to count UP, thus measuring the pulse width. Then, when PIN#3 goes LOW, FSM1 stops and the falling edge at PIN#3 through inverter 2-L4 writes FSM1 counter value into SPI buffer. This operation is repeated each period.

At the same time, CNT2 output sets the output frequency, i.e. the frequency at “OUT” is equal to output frequency of CNT2. The PWM of the output is generated as the counter value of CNT2 is constantly compared with SPI buffer’s value by DCMP1. To change the “OUT” frequency, the setting of CNT2 as well as any element in the clock source chain (CNT1, osc divider, type) can be changed. The clock source can also be taken directly from OSC or external oscillator if desired.

The input frequency of FSM1 (FSM1 CLK) should be selected using following formula:

FSM1 CLK = “IN” frequency × (CNT2 Counter data + 1)

“IN” frequency – frequency at PIN#3

If CNT0 counter data is 255, the formula can be written as:

FSM1 CLK = 256 × “IN” frequency

Shifting Input Frequency From 100 Hz to 300 Hz

fig2.jpg

Shifting Input Frequency From 100 Hz to 25 Hz

fig3.jpg

Shifting Input Frequency From 100 Hz to 7.81 KHz

fig4.jpg
fig5.jpg

Shifting Input Frequency From 1 KHz to 4 KHz

fig6.jpg

Conclusions

This design can be used in many projects where there is a need to change a PWM constant input frequency without changing the duty cycle, for example LED backlight, motor controller, voltage regulator etc.