SPWM generation using Arduino uno

hi all…am trying to generate sinusoidal pulse width modulation using arduino-simulink for my inverter board…I simulated the SPWM logic in simulink, then installed the required support package for arduino-simulink…but i am facing some problems…I started from basic…like linking arduino and PWM block…
I checked the output of Arduino pin11 from CRO and it was working fine….
Now I compared sinusoidal and triangular wave in simulink and connected the outout to arduino bloack
When I checked the output from CRO……it was distorted…literally I didn’t get any SPWM wave…
Help me out with this problem…
My Simulink configurations are
Solver: fixed step size
Step size:auto

Triangle wave frequency is 1KHz and sine wave is 50Hz



Are you two doing the same school,college, university project?

Tom... :)

A couple of threads exist for such projects. A triangle wave of 1kHz can be handled in several ways, most of which will reach limits when multiple phases should be output at the same time.

You can try the cookbook methods, and come back for optimizations if you encounter timing problems. In the best case up to 6 phase signals can be output at the rate of a single phase, without blocking other activities in the sketch.