First and second signal detecting element groups are respectively arranged to face first and second signal detecting tracks that are provided on a first code wheel. In addition, third and fourth signal detecting element groups are respectively arranged to face third and fourth signal detecting tracks that are provided on a second code wheel. A code string is output from the first and second signal detecting element groups to obtain a circular gray-code for detecting the rotation of the first code wheel within one revolution. Further, a code string is output from the third and fourth signal detecting element groups to obtain a circular gray-code for detecting the rotation of the first code wheel over one revolution.