An optical encoder. The optical encoder includes a coding element, an
emitter, and a detector. The coding element has a track with a track
pattern. The track pattern includes a plurality of optically
distinguishable sections. The plurality of optically distinguishable
sections includes a limit switch section. The emitter generates a light
signal incident on the track of the coding element. The detector includes
a limit switch photodetector positioned to detect the light signal from
the emitter. The detector generates a limit switch output signal in
response to the detected light signal above a limit switch threshold at
the limit switch photodetector. Embodiments of this type of optical
encoder implement limit switches into a single track on the coding
element.