All,

I have a magazine setup that has 2 switches that act as a quasi encoder. What I am looking for is a starting place to build a C program that will increment and decrement a counter variable. I have 30 stations so my total count should be 30. mIt is driven via hydraulic motor and latches mechanically once triggered in position. I can do the delta for direction control. But, making a counter can be tricky.

Any help is appreciated.