RTM_TimerCalc and PWM Resolution

1 post / 0 new
Runtime Micro's picture
Runtime Micro
Offline
Joined: 07/24/2016 - 9:18am
RTM_TimerCalc and PWM Resolution

RTM_TimerCalc Version 1.20 will be available soon with many improvements and added features. A revision was necessary to make good on claims of What-You-See-Is-What-You-Get (WYSIWYG) performance. When I say make good, I'm referring to PWM Resolution which may not be a term you're familiar with. So let's take a look at PWM Resolution and see what its all about.

What Is PWM?

I'm sure you know PWM stands for Pulse Width Modulation. All this means is the width of the ON part of a pulse stream is varied in duration relative to the OFF time. In technical terms we may say this ON-to-OFF ratio is its Duty-Cycle. Duty-Cycle indicates the length of pulse ON-time. A 25% duty cycle is ON for 1/4 of the Pulse time. A 50% duty is ON for half the Time.

So we know PWM has a duty-cycle (ON-OFF ratio). We know it operates at some frequency. And we know its a useful digital method to simulate a DC equivalent for certain applications.

What Is PWM Resolution?

Resolution is often left out of PWM discussions. Its the smallness (or granularity) of duty-cycle changes we can make. Depending on PWM speed and hardware generating it, this (duty-cycle step-size) can be quite large. If the duty-cycle changes are too big, your PWM project may not behave as hoped. In fact, it may fail in subtle or even spectacular ways.

For example: if your PWM waveform has only 5 duty-cycle steps (not counting 0%), you can only make 20% step size changes. Those are big changes! If you wanted to control a heater or the speed of a motor, its likely this very -low- PWM resolution would lead to failure.

So please know that low PWM Resolution can negatively affect your project. Its something to watch out for, especially in precision control situations.

RTM_TimerCalc and PWM Resolution

In Version 1.01 of RTM_TimerCalc, I claimed WYSIWYG performance. What was dialed up on the Interactive PWM chart was supposed to show up on your Oscilloscope (after you pasted code and compiled).

Unfortunately, I missed the fact that at very high frequencies, RTM_TimerCalc still showed high granularity of PWM adjustment -- even in situations where only low granularity was possible! This was wrong!

At the very least, the app. should have warned you -- it didn't. And it's WYSIWYG display should have showed larger Duty-Cycle steps to match the frequency you dialed up. But again, it didn't. Its my fault...

V1.20 changes for PWM Resolution

After some redesign, I got RTM_TimerCalc to provide Low-Resolution-Warnings as well as correct duty-cycle visuals. If you set up a situation with low PWM Resolution (greater than 1% step-size), you get warned audibly and visually.

In the new WYSIWYG display, you'll see the larger duty-cycle steps (the result of low PWM resolution). You may be surprised when this happens. Its up to you to decide if the resulting low Resolution is acceptable for your PWM use-case.

Bottom line: we're back to valid WYSIWYG operation. Smile

Lee