Absolute encoder and potentiometer