Hello silvabelbr,
It's very simple to generate the 50-Hz PWM using F877/A.
I suppose that you are building Push-Pull Square wave inverter.
If so, use TIMER2 of f877 to generate interrupts every fixed interval say 500uSec. I'll give pseudo-code --
pwm_init()
{
side = 1;
pwm_tick = 0;
pwm_side1 = on;
pwm_side2 = off;
}
timer2_interrupt()
{
// we'll be here every 500us
if( side == 1 )
{ // doing side-1
if( ++pwm_tick == 19 ) // 9.5ms/500us = 19
{
pwm_side1 = off;
}
if( ++pwm_tick == 20 ) // 500us dead-time
{
side = 2; // next time do side-2
pwm_tick = 0; // start again
pwm_side2 = on; // now side-2
}
}
else // doing side-2
{
if( ++pwm_tick == 19 ) // 9.5ms/500us = 19
{
pwm_side2 = off;
}
if( ++pwm_tick == 20 ) // 500us dead-time
{
side = 1; // next time do side-1
pwm_tick = 0; // start again
pwm_side1 = on; // now side-1
}
}
// timer2 will automatically reload
}
With small changes you can add duty-cycle control. Using a smaller pwm_tick like 100us instead of 500us will improve duty-cycle resolution.
Adding inverter output voltage, current & battery voltage feedback will complete your basic inverter scheme. You can add many other features as well.
But, if you are trying to build sine-wave inverter then, pwm generation is not so obvious & cetainly not so easy with PIC-14, though it is possible. (I've done it
)
If you have any doubts, I'll be glad to help.
BTW, sorry for C-syntax, that's what I am used to
reagrds,
sam_des