View speed and length measurement

I want to connect an encoder (1024 pulse per rev;A/A-; B/B-) to view speed and length measurement, length increases and decreases; like 0 - 500 meters, stop, 500 - 350 meters, stop 350 - 400 meters; stop, 400 - 0 meters Stop. How can I determine the (IN/OUT) direction? The encoder in question is a Kubler.

We have a tech note that covers this question.
Take a look at Doc #1823 ‘Using Quadrature Counters Technical Note.pdf’.
The module - assuming you have a SNAP PAC system - is the SNAP-IDC5Q.

Hope that gets you going.