SPWM Inverterwd
SPWM Inverterwd
* Author: BABALOLA
* Description:
This project generate sine-wave PWM in an open loop
using timer0 to generate interupt.
* Test configuration:
MCU: P18F452
Oscillator: HS, 20.0000 MHz
SW: mikroC v8.2
24/03/2010
* NOTES:
*/
// variable/function definitions
unsigned char index;
int duty;
void Interrupt( )
{
INTCON.TMR0IF = 0; // clear TMR0IF(interupt flag that brought us here)
//T0CON.TMR0ON = 0; // STOP TIMER0
TMR0H = 0xF9; // Reload Timer0 register
TMR0L = 0xE5;
CCPR1L = sine_wave[index];
if (!index)
PORTC.F1 = ~PORTC.F1;
++index;
if (index == 32)
index = 0;
void main( )
{
//Prepare PIC for operation,intialise variables and the controller hardware
INTCON.F7 = 0; //diable all interrupt now
TRISC = 0X90; //set portc direction
PORTC.F0 = 1; //disable inverter driver
TRISB = 0XC9; //portb direction
//PORTB.F1 = 1; //hold power supply
// Timer0 Setup
Below is my basic schematic with information about the transformer. My output target is
500WATT.
INFORMATION ON TRANSFORMER:
RATIO IS 1:17
LEAKAGE INDUCTANCE IS 2.76mh which is used with the output capacitor to form the
output filter.
With the accompanied code, I’ am getting 246vac without load at 24 battery voltage.
REGARDS,
BABALOLA.