The driver of dc motor is mainly composed of L298N driver chip and tlp521-4 photoelectric isolation chip, as shown in figure 4.4. When the motor stops, MCU P0.0 and P0.1 port output low level; When the motor is running, MCU P0.0 and P0.1 port output high level; When the motor is turning forward, low level is output from P0.0 port of MCU, and high level is output from P0.1 port. When the motor is reversed, the MCU outputs high level at P0.0 port and low level at P0.1 port. PWM pulse speed adjustment adopts the fixed-frequency width adjustment method, the single-chip microcomputer P2.0 output PWM pulse with a fixed frequency of 1kHz, and the pulse frequency is realized by timing interruption.