Hi, Abdullah,
I think you can use the svpwm function to generate the 220V/50Hz waveform, this is the procedure:
you can use PWM reload event to generate interrupt, the interrupt cycle time is the PWM cycle time. For example, you want to get 50HZ sine waveform with 100 points, the PWM frequency is 8KHz, 8K/50Hz=160 points. For 160 points, the theta increment is 65535/160=409;
In the ISR, you can use the Q15 format to generate the Alpha/Beta coordinator:
static unsigned int ThetaIncret;
Frac16 Theta=409*ThetaIncret
ThetaIncret++;
if(ThetaIncret>=160) ThetaIncret=0;
MCLIB_2COOR_ALBE_T_F16 psIn;
GMCLIB_3COOR_T_F16 psOut;
psIn.f16Alpha=sine(Theta);
psIn.f16Beta=cos(Theta);
uint16_t GMCLIB_SvmIct_F16_FC(&psIn,
&psOut);
The psOUT is the PWM duty cycle of 3 phase.
Hope it can help you
I do not test bthe above code, it is only my idea.
Hope it can help you
BR
Xiangjun Rong