You can use a periodic task and simulate an encoder going clockwise and counterclockwise.

This is a good exercise to learn how a periodic task works. We will simulate an elevator going up and down.  Additionally, we can change the Rate of the periodic task with a SSV instruction to vary the "speed" of the encoder.