Now lets the actually example that I’ll be using.
The above was just a simple example to explain the basic stuff. – This is my convention others might use it in reverse.ĥ0 Hz Sinewave using Microcontroller based PWM 0.25us is a higher Resolution as compared to 1us. Note : A high(i.e more Fine) Resolution in our case means that the actual value is low and vice-verse. and if we have a resolution of 0.5us then valid T-ON values will be 1,1.5,2,2.5. For e.g if we have a resolution of 1us then valid T-ON values would be 1,2,3.
Resolution(PWM) : Its the minimum increment required to increase or decrease the pwm T-ON time i.e Duty Cycle. but we cant increase the resolution after we reach the max resolution which depends on the Processor(& Peripheral) clock. But as divisions increase we also need to increase the resolution. Now we can increase the number of divisions to get more accurate waveform. This is called the Angle Step Rate or Angle Resolution. Hence for 10 divisions we will need to increase the angle in steps of 36 degrees. It takes 360 degrees for a sine wave to complete one cycle. Since out PWM pulse has voltage swing between 0V to 3.3V, our sine wave too will swing between 0V to 3.3V. A PWM pulse with 0% Duty cycle will represent the min amplitude(0V), the one with 100% duty cycle will represent max amplitude(3.3V). So here we will require 10 different PWM pulses increasing & decreasing in sinusoidal manner. Here I’ve divided the Sine wave into 10 divisions. The T-ON time or the duty cycle directly corresponds to the amplitude of the waveform in that division which is calculated using sin() function. For each division we have a single PWM cycle. The basic idea here is to divide the waveform we want, Sine wave in our case, into ‘x’ number of divisions. Now, when we change the dutcycle i.e the T-ON time of PWM in sine fashion we get a sine waveform at the filter output. Where V H is Voltage for Logic HIGH for PMW pulse.