Abstract:
There is provided an absolute position detection type photoelectric encoder which improves robustness to dirt while maintaining high resolution. A two-level code pattern according to a pseudo random code sequence is provided on a scale along a length measurement direction. Each code of the two-level code pattern indicates a code “1” or a code “0”, and includes two bits. Each of the two bits is L or H. The code “1” is represented by an A pattern which is a combination of L and H, and the code “0” is represented by a B pattern which is a combination of L and L or a C pattern which is a combination of H and H. When the codes “0” are continued, the B pattern and the C pattern are alternately used.

Description:
INCORPORATION BY REFERENCE 
       [0001]    This application is based upon and claims the benefit of priority from Japanese patent application No. 2015-180631, filed on Sep. 14, 2015, the disclosure of which are incorporated herein in its entirety by reference. 
       BACKGROUND OF THE INVENTION 
       [0002]    1. Field of the Invention 
         [0003]    The present invention relates to a position detection apparatus, and specifically, relates to an absolute position detection type (absolute type) photoelectric encoder. 
         [0004]    2. Description of Related Art 
         [0005]    There is known an absolute position detection type photoelectric encoder using an absolute (ABS) scale (JP 5553669 B). As an ABS scale pattern of the ABS scale, an M-sequence code which is one of pseudo random code sequences has been used. 
         [0006]    With reference to  FIGS. 1 to 3 , a conventional absolute type photoelectric encoder is described. First, as illustrated in  FIG. 1 , an absolute type photoelectric encoder  100  includes an ABS scale  200  and a detection head part  300  provided to be movable relatively to the length measurement direction along the ABS scale  200 . 
         [0007]      FIG. 2  is an example of an ABS scale pattern of the ABS scale  200 . As the ABS scale pattern, an M-sequence code which is one of pseudo random code sequences is used. When N number of continuous codes in the M-sequence code pattern are extracted, the pattern formed by the N number of codes appears once in a period of the M-sequence code pattern. 
         [0008]    In the example of  FIG. 2 , codes of “1” and “0” are each represented by two bits in the ABS scale pattern in which the codes “1” and “0” are randomly arranged. 
         [0009]    The two bits of the code “1” are a combination of a transmitting part (light-transmissive part) and a reflecting part. On the other hand, the two bits of the code “0” are both the transmitting parts. 
         [0010]    Here, for the sake of description below, the transmitting part (light-transmissive part) is referred to as a dark part (or “L”), and the reflecting part is referred to as a bright part (or “H”). 
         [0011]    The detection head part  300  includes a light source  310 , a lens  320 , a light receiving part  330 , and a signal processing unit  400 . 
         [0012]    The light source  310  emits light toward the ABS scale  200 . The light is reflected at the reflecting part of the ABS scale  200  and transmitted at the transmitting part. The reflected light enters a light receiving surface of the light receiving part  330  through the lens  320 . 
         [0013]    On the light receiving surface of the light receiving part  330 , a bright and dark image pattern is formed according to the ABS scale pattern. 
         [0014]      FIG. 3  illustrates the light receiving surface of the light receiving part  330 . 
         [0015]    A photodiode array  340  is provided on the light receiving surface of the light receiving part  330 . The photodiode array  340  is formed by arranging photodiodes  341  at a pitch with which a pitch of the ABS scale pattern can be detected. Each of the photodiodes  341  constituting the photodiode array  340  includes a switch  342 , and is connected to the signal processing unit  400  through the switch  342 . By sequentially turning the switch  342  ON, a light receiving signal from each of the photodiodes  341  is swept. 
         [0016]    The signal processing unit  400  includes an image acquisition unit  410  and a correlation calculation unit  420 . The correlation calculation unit  420  stores design data of the ABS scale pattern as a reference pattern in advance. The correlation calculation unit  420  performs correlation calculation between a signal pattern acquired at the light receiving part  330  and the reference pattern, and obtains a position from a peak of the correlation. The absolute position on the ABS scale pattern is acquired in this manner. 
       SUMMARY OF THE INVENTION 
       [0017]    While the ABS photoelectric encoder is used, the ABS scale pattern can become dirty due to dust or the like entering between the ABS scale  200  and the detection head part  300 . If dirt adheres to the ABS scale pattern, the signal pattern acquired at the light receiving part  330  changes under the influence of the dirt. If correlation calculation is performed based on the signal pattern having changed due to the dirt, a peak of the correlation appears at an incorrect position, and which increases the possibility of falsely detecting the position. 
         [0018]    For example, an example is illustrated in  FIG. 4 . 
         [0019]    As illustrated in the lower row of  FIG. 4A , the dirt adheres to the scale pattern, but this part is originally non-reflecting parts and the signal pattern does not change in the end. However, as illustrated in  FIG. 4B , when the dirt adheres to the part which is originally the reflecting parts, the signal pattern changes, and which can lead to false detection. 
         [0020]    For that reason, there have been proposed methods to avoid falsely detecting a position due to dirt. 
         [0021]    One of the methods is to sufficiently increase the number of codes used for correlation calculation. However, as the number of codes used for correlation calculation is increased, the calculation amount is increased accordingly. Furthermore, no matter how the number of codes used for correlation calculation is increased, false detection is inevitable. 
         [0022]    As another method, in JP 5553669 B, there has been proposed a method to divide an ABS scale pattern at a certain pitch, and shift a part of the pattern to the length measurement direction. However, position resolution of the ABS scale inevitably becomes coarse with this method. 
         [0023]    A purpose of the present invention is to provide an absolute position detection type photoelectric encoder which improves robustness to dirt while maintaining high resolution. 
         [0024]    A scale according to an aspect of the present invention is a scale used for an absolute position detection type photoelectric encoder, the scale includes: 
         [0025]    a two-level code pattern, according to a pseudo random code sequence, provided along a length measurement direction, in which 
         [0026]    each code in the code pattern consists of a combination of two bits, and three or more bit combination patterns are used to represent the two-level code. 
         [0027]    In an aspect of the present invention, it is preferable that each code of the two-level code pattern indicates a code “1” or a code “0”, 
         [0028]    each code includes two bits, 
         [0029]    each of the two bits is L or H, 
         [0030]    the number of continuous L in the two-level code pattern is equal to or less than an upper limit value, and 
         [0031]    the number of continuous H in the two-level code pattern is equal to or less than an upper limit value. 
         [0032]    In an aspect of the present invention, it is preferable that two or more combination patterns of the two bits representing the code “0” are prepared, and 
         [0033]    a combination pattern different from an adjacent combination pattern is used when the codes “0” are continued. 
         [0034]    In an aspect of the present invention, it is preferable that 
         [0035]    the code “1” is represented by an A pattern which is a combination of L and H, 
         [0036]    the code “0” is represented by a B pattern which is a combination of L and L, or by a C pattern which is a combination of H and H, and 
         [0037]    the B pattern and the C pattern are alternately used when the codes “0” are continued. 
         [0038]    In an aspect of the present invention, it is preferable that 
         [0039]    each code of the two-level code pattern indicates a code “1” or a code “0”, 
         [0040]    each code includes two bits, 
         [0041]    each of the two bits is L, H, or M, 
         [0042]    the code “1” is represented by an A pattern which is a combination of L and H, 
         [0043]    the code “0” is represented by two or more patterns selected from a B pattern which is a combination of L and L, a C pattern which is a combination of H and H, and a D pattern which is a combination of M and M, and 
         [0044]    a combination pattern different from an adjacent combination pattern is used when the codes “0” are adjacently continued. 
         [0045]    In an aspect of the present invention, it is preferable that the code “1” and the code “0” are replaceable with each other. 
         [0046]    A photoelectric encoder in an aspect of the present invention includes: 
         [0047]    the scale; and 
         [0048]    a detection unit provided to be relatively movable along the scale and configured to detect an absolute position on the scale based on the pseudo random code sequence on the scale. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0049]      FIG. 1  is a diagram illustrating a configuration of an absolute type photoelectric encoder; 
           [0050]      FIG. 2  is a diagram illustrating an example of an ABS scale pattern of an ABS scale; 
           [0051]      FIG. 3  is a diagram illustrating a light receiving surface of a light receiving part; 
           [0052]      FIG. 4A  is a diagram illustrating that dirt adheres to a scale pattern; 
           [0053]      FIG. 4B  is a diagram illustrating that dirt adheres to a scale pattern; 
           [0054]      FIG. 5A  is a diagram illustrating an example of an ABS scale pattern formed with a represent method based on a conventional manner; 
           [0055]      FIG. 5B  is a diagram illustrating an example of an ABS scale pattern formed with a method according to an embodiment of the present invention; 
           [0056]      FIG. 6  is a diagram illustrating examples of bit patterns each representing a code; 
           [0057]      FIG. 7  is a diagram explaining an arrangement rule of a B pattern and a C pattern which represent “0”; 
           [0058]      FIG. 8A  is a diagram explaining an effect of an embodiment of the present invention; 
           [0059]      FIG. 8B  is a diagram explaining an effect of an embodiment of the present invention; 
           [0060]      FIG. 9A  is a diagram explaining a modified example; 
           [0061]      FIG. 9B  is a diagram explaining a modified example; 
           [0062]      FIG. 9C  is a diagram explaining a modified example; 
           [0063]      FIG. 10A  is a diagram explaining a modified example; 
           [0064]      FIG. 10B  is a diagram explaining a modified example; 
           [0065]      FIG. 10C  is a diagram explaining a modified example; 
           [0066]      FIG. 10D  is a diagram explaining a modified example; 
           [0067]      FIG. 11  is a functional block diagram of a signal processing unit; 
           [0068]      FIG. 12  is a flowchart explaining an operation procedure of a signal processing unit; 
           [0069]      FIG. 13  is a flowchart explaining a procedure of dirt determination processing; 
           [0070]      FIG. 14  is a diagram illustrating examples of quantization, masking, and coding; 
           [0071]      FIG. 15  is a flowchart explaining a third exemplary embodiment; 
           [0072]      FIG. 16  is a flowchart explaining the third exemplary embodiment; and 
           [0073]      FIG. 17  is a flowchart explaining the third exemplary embodiment. 
       
    
    
     DETAILED DESCRIPTION 
       [0074]    Embodiments of the present invention are illustrated, and described with reference to reference signs attached to the elements in the drawings. 
       First Exemplary Embodiment 
       [0075]    With reference to  FIGS. 5 to 8 , a first exemplary embodiment of the present invention is described below. 
         [0076]    A basic configuration according to the present embodiment is the same as that described with reference to  FIGS. 1 to 3 . 
         [0077]    A feature of the present embodiment is the way to form an ABS scale pattern, specifically, the way to represent codes of “1” and “0” on the ABS scale pattern. 
         [0078]      FIG. 5A  illustrates an ABS scale pattern formed with a represent method based on a conventional manner. 
         [0079]      FIG. 5B  illustrates an example of the ABS scale pattern formed with a method according to the present embodiment. 
         [0080]    In the conventional manner of  FIG. 5A , as described above, the codes “1” and “0” are each represented by two bits, the two bits of the code “1” are a combination of a dark part (L) and a bright part (H), and the two bits of the code “0” are both the dark parts. 
         [0081]    In the ABS scale pattern in  FIG. 5B  according to the present embodiment, the code “1” is a combination of a dark part and a bright part similarly to the conventional manner. This combination of (bright, dark) is referred to as an A pattern. 
         [0082]    The way to represent the code “0” is different from that in the conventional manner. 
         [0083]    As illustrated in  FIG. 6 , two patterns to represent the code “0” are prepared. The code “0” is represented by a B pattern in which the two bits are both the dark parts and by a C pattern in which the two bits are both the bright parts. The B pattern is a combination of (dark, dark), and the C pattern is a combination of (bright, bright). 
         [0084]    In this manner, the same code “0” is represented by using the two patterns. 
         [0085]      FIG. 7  is a diagram explaining a design rule to determine which one of the B pattern or the C pattern is arranged to represent the code “0”. 
         [0086]    To represent the code “0”, by referring to the immediately previous code “0” (here, at the left side), the B pattern and the C pattern are to be alternately arranged. 
         [0087]    In the example of  FIG. 7 , the leftmost code “0” can be either one of the two patterns, and is assumed to be the C pattern. 
         [0088]    The right of this code “0” is the code “1”, and the A pattern is arranged. 
         [0089]    The code “0” on the right of this code “1” is described. 
         [0090]    By referring to the left side of this code “0”, the immediately previous code “0” is the C pattern. Thus, the B pattern is used for this code “0”. Furthermore, to represent the code “0” on the right of this code “0”, the C pattern different from the previous B pattern is used. 
         [0091]    In this manner, to represent a code “0”, by using a pattern different from that used for the immediately previous code “0” at the left side, the number of continuous dark parts or continuous bright parts is three at the maximum. 
         [0092]    In other words, when four or more bright parts or dark parts are continued in the signal pattern detected at the light receiving part  330 , the pattern deviates from the design rule, and it can be determined that the pattern is affected by some kind of dirt. 
         [0093]    As illustrated in  FIG. 8A , the dirt adheres to the part of the codes “0”. If all of the codes “0” are the non-reflecting parts, whether the pattern is the code 0 or dirt cannot be distinguished from the signal pattern. In this case, the signal pattern does not change in the conventional manner in the end, but the result is merely a coincidence. 
         [0094]    In contrast, the ABS scale according to the present embodiment does not have continuous four or more dark parts. Thus, it can be determined that the continuous four or more dark parts are dirt. 
         [0095]    As illustrated in  FIG. 8B , the dirt adheres to the part of the codes “1”. In this case, the signal pattern changes obviously. 
         [0096]    Naturally in this case, it is determined that continuous four or more dark parts are dirt, and it is possible not to use the result for correlation calculation. 
         [0097]    In other words, the incorrect “0” which is originally “1” is not used for correlation calculation. As a result, the case in which a peak of the correlation appears at a wrong position in the correlation calculation does not happen. Thus, a wrong position is not recognized in the position detection. 
         [0098]    Note that, it has been assumed that the dirt becomes the non-reflecting parts in the above description. However, the same effect can be obtained when the dirt reflects light in the present embodiment. In other words, in accordance with the design rule of the present embodiment, four or more bright parts are not continued. If four or more bright parts are continued, it can be determined that that the pattern is affected by dirt. 
         [0099]    By using the ABS scale according to the present embodiment in this manner, it is possible not to use incorrect data due to dirt for correlation calculation. Thus, the accuracy (reliability) of the position detection is improved. 
         [0100]    Furthermore, by alternately using the B pattern and the C pattern which represent the code “0” in the present embodiment, the appearance frequency of the bright part is substantially equal to that of the dark part. This facilitates the setting of a threshold from the received-light intensity to perform quantization, and it is possible to reduce the load on the signal processing unit  400  or simplify the signal processing unit  400 . 
       Modified Example 1 
       [0101]    Next, a modified example  1  is described below. 
         [0102]      FIG. 9  is a diagram explaining the modified example 1. 
         [0103]    In the above described embodiment, the B pattern and the C pattern which represent the code “0” are necessarily alternately arranged. 
         [0104]    In the modified example 1, the flexibility when the B pattern or the C pattern is selected may be enhanced as long as four or more dark parts or four or more bright parts are not continued. 
         [0105]    For example, as illustrated in  FIGS. 9A and 9B , when the code “0” is separately isolated, that is, when both sides of the code “0” are the codes “1”, either of the B pattern or the C pattern may be used to represent the code “0”. In either case, four or more bright parts or four or more dark parts are not continued. 
         [0106]    However, as illustrated in  FIG. 9C , when two or more codes “0” are continued, the B pattern and the C pattern need to be alternate. 
         [0107]    As long as at least the design rule is followed, four or more bright parts or four or more dark parts are not continued. 
       Modified Example 2 
       [0108]    A modified example 2 is described below. 
         [0109]    A feature of the modified example 2 is to use three patterns to represent the two codes of “1” and “0”. 
         [0110]    Thus, for example, the patterns may be the patterns as illustrated in  FIG. 10A . 
         [0111]    In  FIG. 10A , two patterns are used to represent the code “0”; both two bits are the dark parts (the B pattern), and both two bits are halftone parts. The pattern in which both two bits are the halftone parts is referred to as a D pattern. 
         [0112]    In other words, the B pattern and the D pattern are alternately used to represent the code “0”. 
         [0113]    The bright part and the dark part are represented as “H” and as “L” respectively, and the halftone part (an intermediate part) is represented as “M”. 
         [0114]    Alternatively, the patterns may be the patterns illustrated in  FIG. 10B . 
         [0115]    In other words, the halftone parts constituting the two bits are not implemented by a layer having reflectivity of about 50%, but may be implemented by forming the upper half parts and the lower half parts of the dark parts and the bright parts respectively. 
         [0116]    The patterns illustrated in  FIGS. 10A and 10B  may be further modified as the patterns illustrated in  FIGS. 10C and 10D . 
         [0117]    To represent the code “1”, the order of a pattern is not the dark part and the bright part, but may be the bright part and dark part. 
         [0118]    This pattern is referred to as an A′ pattern. 
         [0119]    Furthermore, to represent the code “0”, the C pattern may be used instead of the B pattern. 
         [0120]    Note that, in the description above, it is needless to say that the code “1” and the code “0” are replaceable with each other. 
       Second Exemplary Embodiment 
       [0121]    Next, a second exemplary embodiment of the present invention is described below. 
         [0122]    As the second exemplary embodiment, a signal processing operation using dirt determination is exemplified. 
         [0123]      FIG. 11  is a functional block diagram of a signal processing unit  500  in the second exemplary embodiment. 
         [0124]    The signal processing unit  500  includes an image acquisition unit  510 , a quantization unit  520 , a dirt determination unit  530 , a masking unit  540 , a coding unit  550 , a correlation calculation unit  560 , and a central processing unit  570 . 
         [0125]    The signal processing unit  500  has mainly a CPU, a ROM, and a RAM, and operates as the above functional units by loading arithmetic programs. 
         [0126]    The operations of the functional units are described with reference to the flowchart in  FIG. 12 . 
         [0127]      FIG. 12  is the flowchart explaining an operation procedure of the signal processing unit  500 . 
         [0128]    First, the image acquisition unit  510  sequentially sweeps signals from the photodiode array  340  of the light receiving part  330 , and acquires images detected by the ABS scale  200  (ST 110 ). Then, the quantization unit  520  sequentially quantizes the acquired detected images (ST 120 ). Here, it is assumed that an appropriate threshold to the received-light intensity has been set. By comparison with the threshold, the dark part and the bright part are distinguished from each other and binarized. Here, for the sake of description below, the dark part is referred to as “L”, and the bright part is referred to as “H”. 
         [0129]    Then, the images are quantized as illustrated in the second row in  FIG. 14 . 
         [0130]    In the example of  FIG. 14 , the dirt adheres to a part of the ABS scale  200 . When the received-light intensity at the photodiode  341  is lower than the threshold, the quantized value thereof is naturally “L”. The result is the same as that in the conventional manner. 
         [0131]    Following the quantization (ST 120 ), dirt determination is performed by the dirt determination unit  530  (ST 130 ). 
         [0132]    With reference to the flowchart in  FIG. 13 , dirt determination processing (ST 130 ) is described below.  FIG. 13  is the flowchart explaining a procedure of the dirt determination processing (ST 130 ). 
         [0133]    To perform the dirt determination processing (ST 130 ), first, a parameter n is initialized to count bits. 
         [0134]    The parameter n is initialized to n=4, for the sake of following processing. 
         [0135]    Here, it is assumed that the quantized values in  FIG. 14  are numbered in order from the left end as 1, 2, 3, . . . . 
         [0136]    The dirt determination unit  530  acquires the quantized value of n-th bit (ST 132 ). Here, it is assumed that n equals four, and the quantized value of the fourth bit is “L”. 
         [0137]    Next, the dirt determination unit  530  acquires the quantized values of the (n-3)th, the (n-2)th, and the (n-1)th bits, that is, the quantized values of the continuous four bits (ST 133 ). Here, n equals four, and the dirt determination unit  530  acquires the quantized values of the first bit, the second bit, and the third bit (ST 133 ). 
         [0138]    Then, the dirt determination unit  530  determines whether the quantized values of the continuous four bits are the same. 
         [0139]    In the design rule of the ABS scale pattern, the maximum number of continuous quantized values having the same value is three, and four or more quantized values having the same value (L or H) are not continued. Therefore, the n-th bit to be determined is compared to the quantized values of the immediately previous three bits. 
         [0140]    When all of the quantized values of the (n-3)th to n-th bits are not the same (ST 134 : NO), the pattern is possible at least in the design rule and is reliable, and the quantized value of the n-th bit is not masked (ST 135 ). 
         [0141]    On the other hand, when all of the quantized values of the (n-3)th to n-th bits are the same (all H or all L) (ST 134 : YES), the quantized value of the n-th bit deviates from the design rule and cannot be reliable, and it is determined that the pattern is affected by dirt. 
         [0142]    In this case, the quantized value of the n-th bit is masked not to be used (ST 136 ). 
         [0143]    The processing of ST 132  to ST 138  is repeated until the parameter n reaches the number of all bits of the acquired images. When the parameter n reaches the number of all bits of the acquired images, the dirt determination is terminated (ST 137 : YES). 
         [0144]    The third row in  FIG. 14  illustrates ON/OFF of masking. 
         [0145]    When the dirt determination is terminated (ST 130 ), then, coding is performed by the coding unit  550  (ST 150 ). To perform coding, the quantized value of an unmasked bit is used. 
         [0146]    One code is represented by two bits. 
         [0147]    A pair of (L, H) is converted into the code “1”. 
         [0148]    Pairs of (L, L) and (H, H) are converted into the code “0”. 
         [0149]    The fourth row in  FIG. 14  illustrates an example of a coded result. 
         [0150]    By the masking (ST 136 ), quantized values are unknown in some part. Naturally, in the part of the masked bits, the codes are unknown. In  FIG. 14 , the unknown values are represented by “?”. 
         [0151]    The correlation calculation between the coded data and the reference pattern is performed in this manner (ST 160 ). The position indicating the highest correlation in the correlation calculation is calculated as the current absolute position (ST 170 ). 
         [0152]    By performing the processing in the second exemplary embodiment, it is possible to distinguish the uncertain code due to dirt. Furthermore, it is possible not to use the uncertain code for correlation calculation. Thus, the accuracy (reliability) of the position detection is improved. 
       Third Exemplary Embodiment 
       [0153]    With reference to flowcharts in  FIGS. 15 to 17 , a third exemplary embodiment is described below. 
         [0154]    In the second exemplary embodiment, the dirt determination has been described. 
         [0155]    By the dirt determination (ST 130 ), a reliable quantized value and an unreliable quantized value can be distinguished. Thus, when a predetermined number of reliable quantized values are obtained, the quantization processing and the dirt determination processing may be terminated. 
         [0156]    To avoid overlapped descriptions, the same step numbers are attached to the processing steps common to those in the second exemplary embodiment. The processing is briefly described in order. 
         [0157]    In ST 110 , detection images are acquired from a light receiving part  330 . Then, a quantization unit  520  quantizes the detection images. In the present exemplary embodiment, all of the detection images are not quantized at once, but the required detection images are sequentially quantized. 
         [0158]    To perform dirt determination (ST 130 A), first, the quantization is performed from the first bit to the fourth bit (ST 111  to ST 123 ). Then, when the quantization is performed to the fourth bit (ST 122 ), the dirt determination is performed to the fourth bit (ST 130 A). 
         [0159]    The procedure of the dirt determination is the same as that in the second exemplary embodiment. As illustrated in  FIG. 16  again, when the dirt determination is performed to the target bit (the n-th bit), the dirt determination is temporarily terminated. 
         [0160]    Returning back to  FIG. 15 , following the dirt determination (ST 130 A), whether a termination condition is satisfied is determined (ST 140 ). 
         [0161]    Termination condition determination (ST 140 ) is shown in the flowchart in  FIG. 17 . 
         [0162]    As the termination condition, whether the number of bits to which the masking is not performed is equal to or more than a predetermined number (here, 40) is determined (ST 141 ). 
         [0163]    The predetermined number (here, 40) is the number of bits necessary for the correlation calculation. The predetermined number is referred to as a calculable number. 
         [0164]    Note that, taking the error rate of the dirt determination (ST 130 A) into consideration, it is preferable that the predetermined number (calculable number) is set so that the theoretical minimum number has a margin. For example, it is assumed that the theoretical minimum number is 20, here, the calculable number is 40 which is twice the theoretical minimum number. 
         [0165]    When the present embodiment is not used, it is common to have redundancy to be about four times the theoretical minimum number. In the present embodiment, the calculable number may be set within a range so as to be one to three times the theoretical minimum number. Preferably, the calculable number is to be 1.5 to 2.5 times the theoretical minimum number, and more preferably, to be 1.5 to 2.0 times. Naturally, when the accuracy of the dirt determination is extremely high, the calculable number can be set within a range so as to be 1.1 to 1.3 times the theoretical minimum number. 
         [0166]    When the data necessary for the correlation calculation is prepared (ST 141 : YES), the quantization (and the dirt determination) is terminated (ST 140 : YES), and the processing proceeds to the coding (ST 150 ). 
         [0167]    On the other hand, when the number of the bits to which the masking is not performed does not reach the predetermined number (ST 141 : NO), whether the parameter n reaches the upper limit of the number of bits is determined (ST 142 ). 
         [0168]    When the number of bits reaches the upper limit, the processing is terminated (ST 142 : YES). 
         [0169]    When the data necessary for the correlation calculation is not obtained (ST 141 : NO) and the number of bits reaches the upper limit (ST 142 : YES), the scale becomes too dirty, and the reliable correlation calculation cannot be performed. Therefore, an alert of scale dirt is notified to a user (ST 143 ). 
         [0170]    When the parameter n does not reach the upper limit of the number of bits (ST 142 : NO), the quantization (ST 121 ) and the dirt determination (ST 130 A) are successively performed (ST 140 : NO, ST 145 ). 
         [0171]    Following the coding (ST 150 ), the correlation calculation (ST 160 ) is the same as that in the second exemplary embodiment, and the description thereof is omitted. 
         [0172]    According to the third exemplary embodiment, when the quantized values, having high reliability, necessary for the correlation calculation are obtained, the processing of the quantization and coding is terminated. Thus, it is possible to accelerate the calculation processing and reduce the load on the signal processing unit. 
         [0173]    Furthermore, the number of codes used for the correlation calculation is reduced, the effects on accelerating the calculation processing and reducing the load on the signal processing unit are remarkably large. 
         [0174]    Note that, the present invention is not limited to the above embodiments, and can be changed without deviating from the scope. In the above embodiments, it has been exemplified that the ABS scale is reflective, but the ABS scale may be transmissive. 
         [0175]    It has been described that the masking is not performed when the reliability of the quantized values is high (ST 135 ), and the masking is performed when the quantized values are not reliable(ST 136 ), but this is merely an example. A flag indicating high reliability or unreliability may be used, any means can be used as long as the similar effect is obtained. 
         [0176]    In the above embodiments, a linear scale and encoder have been exemplified, but the present invention can be applied to a rotary encoder.