Nowadays, there is an increasing trend in automobiles that a mechanical drive system is replaced with an electrical drive system using a motor in order to satisfy needs such as reducing size, increasing ease of assembly, and improving controllability. In an example of such an electrical drive system, a range change mechanism in an automatic transmission of a vehicle is driven using a motor. In this system, an encoder outputs a pulse signal synchronously with rotation of the motor at a predetermined angle, and a gear range is changed to a target range by rotating the motor to a target position corresponding to the target range based on a count value (hereinafter referred to as the “encoder count value”) of the pulse signals outputted from the encoder.
In this type of system, when power is turned ON, an energization phase learning process is performed by executing an initial drive of the motor. In the energization phase learning process, a relationship between an energization phase of the motor and the encoder count value is learned. Then, a strike control process is performed to learn a reference position (i.e., limit position) of the motor. In the strike control process, the motor is rotated until the range change mechanism strikes a limit (i.e., wall) of its movable area. The rotation amount (i.e., rotation angle) of the motor is controlled with respect to the encoder count value obtained when the motor is at the reference position. The energization phase learning process and the strike control process are hereinafter sometimes collectively referred to as the “reference position learning process”. The reference position learning process is performed each time a microcomputer which controls the motor returns to a wakeup mode (i.e., active mode) from a sleep mode.
JP-A-2012-170213 discloses a technique to reduce the number of times the reference position learning process is performed. According to the technique, the reference position learning process is not performed when the output signal of the encoder does not change during a period of time where the microcomputer is in a sleep mode. In contrast, when the output signal of the encoder changes during a period of time where the microcomputer is in a sleep mode, the microcomputer switches to the wakeup mode from the sleep mode at that time. In this case, if it is determined that only one of A-phase and B-phase signals changes, a correction process is performed so that the encoder count value can be corrected by one. In contrast, if it is determined that both the A-phase and B-phase signals change, the reference position learning process is performed.
It is noted that even after the microcomputer finishes rotating the motor, the rotation position of the motor may be displaced a little by a detent mechanism, which keeps the range change mechanism at a position corresponding to each gear range, so that the output signal of the encoder may be changed accordingly. In the technique disclosed in JP-A-2012-170213, the microcomputer switches to the sleep mode after finishing rotating the motor. Therefore, if the microcomputer switches to the sleep mode just after finishing rotating the motor, it is likely that the output signal of the encoder will be changed by the detent mechanism after the microcomputer switches to the sleep mode. In this case, if both the A-phase and B-phase signals are changed by the detent mechanism, the reference position learning process is performed. Therefore, the number of times the reference position learning process is performed cannot be reduced effectively. In addition, in the technique disclosed in JP-A-2012-170213, the microcomputer switches to the wakeup mode from the sleep mode each time the output signal of the encoder changes. Accordingly, power consumption may be increased.