Measuring position is important in most factory control environments, the home of a lot of embedded systems. More often than not some sort of encoder provides all of the location data to a computer. An encoder is a mechanical device coupled to a rotating shaft that provides a digital representation of the shaft's position. Modern encoders almost exclusively use optical techniques to convert the shaft's angle to digital form. A beam of light shines though a disk fixed to the spindle.
Photocells detect marks on the disk.
Depending on the type of encoder, these marks will represent either an absolute or relative position. Shaft Encoders Shaft encoders convert position information into an absolute binary code. A 12 bit encoder will output 0000 with the shaft at zero degrees. At 90 degrees the code will be one quarter of the full scale reading, or 400 hex. 180 degrees is 800h, until just before 0 degrees FFFh is output.