page1
Read sensors
Resolve position
ISR: Shaft moved
End
Empty read?
Yes
No
End
ISR: PWM tick timer expired
End
PWM doing mark?
Yes
No
Reset PWM tick counter
Set space
Reset field output
Update PWM tick counter
Still on Mark?
(not expired)
Yes
No
Space
> 0?
Yes
No
Switch PWM to space
Reset PWM tick counter
Set mark
Still on Space?
(not expired)
Yes
No
Mark
> 0?
Yes
No
Switch PWM to mark
Switch PWM to space
Store Position
Read sensors
Resolve position
ISR: Shaft moved
End
Empty read?
Yes
No
End
Get phase angle
Store Position
Doing mark?
Yes
No
Reset PWM tick counter
Set new field position