Welcome to 24-channel Servo Drive Board repository
2.3 C51
C51 Control servo board
Learning objectives
In this course, we mainly learn to use the 89C52RC 51 single-chip microcomputer and the 24 channel servo control board to realize serial port control servo.
Preparation before class
In this example, the 16 channel servo drive module uses serial communication, connecting the TXD and RXD of the module to P3.0 and P3.1 pins of the 51 board respectively. VCC and GND are connected to VCC and GND respectively. The wiring diagram is as shown in the figure.

4.Code
Configure the serial port and baud rate.

Servo control function. According to the protocol, 0x24 and 0x23 are the header and trailer of data packets respectively.

In the main cycle, the relevant steering gear rotation angle will be sent every 1s.
4.Experimental phenomena
Run after downloading the program, and the servo S1 turns to 0° after 1s; Turn the servo S1 to 90° after 1s; Turn the rear steering gear S1 to 180° for 1s.