I am doing an 8th semester project but I need to use an IR transmitter and receiver to find the wheel direction of car. I would like 8051 assembly level code to find wheel direction. I am using two IR transmitters and receivers to find direction. I am mounting these two IR modules to get following combination of output.
clockwise direction
LH-HH-HL-LH
Anti clockwise direction
LH-HL-HH-LH
Best Answer
This isn't the usual rotary encoder pattern, but it should still work. See this wikipedia section for the normal gray-code implementation.
Basically, you will need to:
The disadvantage of your setup is that it takes two transmitters, probably has a more complicated pattern drawn, and there's no way to identify if the encoder has gone 2 steps instead of 1. Additionally, only one bit changes with the gray code count, so the comparison routine is easier and not a look-up table.