Hi,
How about
:
Code:
'PWM U phase calculation
uduty=((sin(t)+128)*4)
'PWM V phase calculation
vduty=((sin(t+85)+128)*4)
'PWM W phase calculation
wduty=((sin(t+170)+128)*4
Attachment 5180
It's true that you can't mutliply by 0.5 but you can divide by 2. You can also use the ** operator to multiply by units of 1/65536 so instead of doing x=y*0.72 you do x=y**47186 (where 47186 comes from 65536*0.72)
/Henrik.
Bookmarks