PURPOSE: To secure the simple decision for the reference potential under detection of characters by increasing the counter value when the input signal is higher than the 1st potential, decreasing the counter value when the input signal is at the middle value between the 1st and 2nd potential, and keeping the counter value when the input signal is lower than the 2nd potential respectively.
CONSTITUTION: Analog detection signal 1 detected through the photo detector is applied to comparators 31 and 32 each, and output 2 of D/A converter 6 is applied to the other input of comparator 31. At the same time, output 3 obtained by giving the voltage division to the output of converter 6 via voltage divider 7 is applied to comparator 32. Then the value of counter 5 is increased when the output of comparators 31 and 32 is higher than the 1st potential, and the counter value is decreased when the output is lower than the 2nd potential. And furthermore, the value of the counter is held in case the output features the middle value between the 1st and 2nd potential. Then the output of counter 5 is applied to converter 6, and the control is given to A/D converter 2 which converts the analog signal of input signal 1 into the digital signal via output 3 passed through divider 7. Thus the reference potential can be set in a simple way.