sine wave generation with fast pwm mode 2525

Generate sinusoidal pulse width modulation (SPWM) signals using the ECCP module in a PIC for generating a sine wave output for use in DC-AC inverter. I have had requests from people asking how to generate the same SPWM signals with other microcontrollers that don`t have the ECCP module, such as the super popular PIC16F877A. And so I had written another article where I showed how to generate

sine wave using SPWM with the CCP module of a PIC. This concept, as I had mentioned in that tutorial, can be extended to use for any microcontroller that has a PWM module. And so, I`ve decided to demonstrate how to generate sine wave using SPWM with an Atmel AVR microcontroller. The microcontroller I`ve chosen is the ATMEGA16. However, the concept can be used on any AVR that has a PWM module. The output sine wave is to have a frequency of 50Hz. I have chosen to use a switching frequency of 16kHz for SPWM. So, here I talk about how to generate sine wave using sinusoidal pulse width modulation (SPWM) signals using the PWM module as can be commonly found on most Atmel AVR microcontrollers. If you`re curious regarding my previous tutorials that revolved around the Microchip PIC microcontrollers, you should go through the other articles related to generating SPWM to get an idea of what I`m talking about regarding sine wave generation: Below (Fig. 2) is the circuit diagram for the configuration of the MOSFETs and the drivers - and the synchronization with the signals generated from Fig. 1 above. Here, I`ve used the Fast PWM mode. I chose to use an oscillator frequency (for ATMEGA16) of 16MHz and an SPWM switching frequency of 16kHz. For this, I selected ICR1 as the TOP and assigned 999 to ICR1. I used a prescaler divider (N) = 1. I used PWM mode 14. So that gives a switching frequency of: I`ve assigned 0x82 to TCCR1A and 0x19 to...

Leave Comment

characters left:

New Circuits