3 PWM for 3 phase inventer

polyglot:
I think the assumption of your first sentence is basically wrong. When doing a 3 phase drive, the PWM frequency will be much higher than the commutation frequency (in order to obtain good current control, especially with non-constant current per commutation) therefore there is no need for any phase difference in the PWM signals.

For a 50Hz motor, the commutation frequency is 50Hz but the PWM will be a few kHz.

If you're trying to generate three sine waves from PWM with a phase offset, that's totally reasonable. You just have three different indices into your sine table, offset by 1/3 of the table's length. You basically have it with OFFSET_1 etc but you didn't wrap the values so you're reading off the end of the sine table. Do something like this instead:

pwm1=sine256[icnt];

pwm2=sine256[(icnt+OFFSET_1)&0xFF];
pwm3=sine256[(icnt+OFFSET_2)&0xFF]




The PWM signals will all be mostly in phase but that doesn't matter; the sine waves will be out of phase. In fact if you zoom out on your waveform view, you might find that you are very close already.

thx but can you explain more what i can do in program

the 3 tables of sine wave

 int sinus0[]={0,10,20,31,41,51,61,71,81,91,101,110,119,128,137,146,154,163,
              170,178,185,192,199,205,211,217,222,227,231,236,239,243,246,248,250,252,
              253,254,254,254,254,253,252,250,248,246,243,239,236,231,227,222,217,211,
              205,199,192,185,178,170,163,154,146,137,128,119,110,101,91,81,71,61,
              51,41,31,20,10,0};
int sinus1[]={220,225,230,234,238,242,245,247,250,251,253,254,254,254,254,254,252,251,
              249,246,244,240,237,233,228,224,219,213,207,201,194,188,180,173,165,157,
              149,140,131,122,113,104,94,85,75,65,55,44,34,24,13,3,6,17,
              27,38,48,58,68,78,88,98,107,116,126,134,143,152,160,168,175,183,
              190,197,203,209,215,220};
 int sinus2[]={220,215,209,203,197,190,183,175,168,160,151,143,134,125,116,107,97,88,
               78,68,58,48,37,27,17,6,3,14,24,34,45,55,65,75,85,94,
               104,113,123,132,140,149,157,165,173,181,188,195,201,207,213,219,224,229,
               233,237,241,244,247,249,251,252,254,254,255,254,254,253,251,250,247,245,
               242,238,234,230,225,220};