Analog serial uses T1 interrupt 1 (timer 1, external interrupt 1) crystal oscillator 11.0592m. Using the two input and output pins of 51, such as p3.2 and p3.3, set 1 or 0 to represent the high and low level respectively, that is, the bit in serial communication. If the start bit is low level, set it to 0, and the stop bit is high level, set it, and all kinds of data bits and check bits are set to 1 or 0 according to the situation. As for the baud rate of serial communication, it is only the duration of each level. The higher the baud rate is, the shorter the duration is. For example, if the baud rate is 9600bps, the transmission time of each bit is 1000ms / 9600 = 0.104ms, that is, the delay between bits is 0.104ms. The delay of single-chip microcomputer is achieved by executing several instructions, because each instruction is 1-3 instruction cycles, which can be delayed by several instruction cycles. The single-chip microcomputer usually uses 11.0592m crystal oscillator. Now I want to tell you the origin of this strange number. With this frequency, the time of each instruction cycle is (12 / 11.0592) us, and the baud rate is 9600bps. How many instruction cycles does each instruction cycle need to melt? Instruction cycle s = (1000000 / 9600) / (12 / 11.0592) = 96, which is exactly an integer. If it is 4800bps, it is 96x2 = 192, if it is 19200bps, it is 48. Other baud rates and so on are just integer instruction cycles. See Figure 4.1 As shown in the overall software design flow chart, initialization, delay, (waiting for serial receiving interruption, starting timer, receiving data, closing timer, counting, data storage in array, cyclic receiving), delay, judge whether all receiving is completed, (starting timer, sending data, closing timer, counting judgment, cyclic sending), recycle waiting for receiving data.