Hi,
What is this encoder you're using? Is it some kind of resolver with digital output? And why does the seqeunce change (not just reversing) when you reverese the direction of rotation? Or am I missunderstanding?
If knowing the intended direction of rotation isn't enough then I currently don't see how it's going to be done since the sequence is the same in both directions.
Are you sure you don't have a second output on that encoder? This looks like a low resolution sine-wave to me which leads me to belive what you have is some kind of SIN/COS resolver with a digital interface. (?) Do you have a datasheet you can link to?
The MCPWM module on the '4431 has dedicated faultinputs which can be setup to shut down the PWM. Either until the fault-input is cleared (good for cycle-by-cycle current limit) or untill a fault reset of the module is performed. Perhaps you could use that to stop the commutation. Otherwise you'll simply need to check the state of the switch as often as you need to - or use an external interrupt.
/Henrik.
Bookmarks