【正文】
or drive circuit is shown in Figure 3. L298 integrated chip’s input ports connect with the system MCU I/O ports and its output ports connect with the signal input ports of twophase four wires stepper motor. MCU I/O ports output certain timing pulse signals to drive chip to control its outputs, which makes the stepper motor rotate positively or reversely. Stepper motor rotational speed is directly proportional to the frequency of input pulse, which means the higher frequency of the input pulse, the faster stepper motor rotate speed, and vice versa. The internal circuits of L298 chip are Hbridge driver circuits, as shown in Figure 4. VD1, VD2, VD3, VD4 are continued flow diodes for protecting the drive circuit. When Q1, Q4 binate tubes in the Hbridge circuit turn from on to off, the current can’t change immediately and flows as original direction, VD2, VD3 provide loop circuit at this time. When Q1, Q4 disconnect the current forms a continued flow loop as follows: GND→ VD3 →stepper motor → VD2 →VCC. Simila rly, VD1, VD4 provide flow loop when Q2, Q3 turn from on to off, the current forms a continued flow loop as follows: GND → VD4 →stepper motor → VD1 →VCC. D1 and D6, D2 and D5, D3 and D8, D4 and D7 are quadruplet binate tubes of continued flow in the drive circuit. Infrared detection module design The infrared detection circuit is posed of infrared emitting and receiving tubes and parator as shown in figure 5. The infrared emitting tubes are installed at the point of O, A, B, C. The infrared receiving tubes are installed at the point of O`, A`, B`, C`. When the infrared receiving tube receives infrared signals, its resistance is quite small。 the voltage at point A is about 4V. When the infrared receiving tube doesn’t receive infrared signals, its resistance is very large, at this time the voltage at A point is about voltage of point B is the reference voltage which is about (realized by adjusting 10K potentiometer) and the parator output port connect with 10K pullup resistor. When the voltage at point A is higher than point B, LM339 outputs highlevel signal to MCU I/O port. Otherwise, LM339 outputs lowlevel signal to MCU I/O port. MCU achieves the exact location of the elevator through detecting high or low level signal output by parator and the key input signal in the system module. MCU control module and key module design Figure 6 MCU control module and keys module circuits MCU control module and keys module circuit is shown in Figure 6. Keys are defined as follows: key is a start key