ljille
Member level 1

I have seen several posts about PWM in order to make a one phase inverter,
and most use a long values table calculated to get the sine wave,

but what if it calculates the duty value each time?
I have a graph where can be seen some details, but I don't see the way to
attach it. There I see I will have to compensate about 1/7 of cicle time due to the
calculation time.
So, What do you think about it?
Thank you in advance for your answer
L.J.
and most use a long values table calculated to get the sine wave,

but what if it calculates the duty value each time?
I have a graph where can be seen some details, but I don't see the way to
attach it. There I see I will have to compensate about 1/7 of cicle time due to the
calculation time.
Code Basic4GL - [expand] 1 2 3 4 5 6 7 8 9 ----------------- picbasic pro: counter=0 loop: duty=sin[(counter/100)] ' to compesate decimal handle in above lines PWM pin,duty,1 ´ PWM pin,duty,cycle at 11,718 Hz counter=counter+ n ' 127 cicles n=1, n= 127/195= 0.65 -> 65 if counter= 19500 then counter=0 goto loop -----------------
So, What do you think about it?
Thank you in advance for your answer
L.J.
Last edited by a moderator: