Hi,
Sure, Select-Case is an option. It's "cleaner" but does result in slightly larger code than multiple IF-THEN statements. But if you're not short on space go ahead.
Another option might be to use BRANCH.
Also, perhaps you can move the GOSUB GetADC and GOSUB SetPWM to right after the If Switch=1 Then statement? That will save you a couple of bytes of program space and since, if I'm not mistaken, all twelve different encoder states calls both those routines you might as well do before evaluting the encoder value.
/Henrik.
Bookmarks