High-speed Control Design of Large-screen LED Display
Taking the MCS51 series single-chip microcomputer as an example, a high-speed control scheme of the single-chip microcomputer to the large-screen LED display is introduced. The display control of the single-chip microcomputer on the LED display screen generally reads data from the data memory first, and then writes the data to the LED dot matrix chip. The innovative point of this scheme is: use a read instruction to the external data memory to simultaneously complete the read operation of the external data memory and the write operation to the LED dot matrix chip. This article introduces the circuit design of the high-speed control scheme in detail, and briefly prompts the main points of the software compilation; finally introduces the application of the high-speed control scheme in the large-screen LED display.
Keywords: high-speed control, LED display, large screen MCS-51
Introduction
The basic working principle of LED display is dynamic scanning. The process of display control is to first read the font data from the data memory, and then write the data to the LED dot matrix through the serial port or parallel port of the microcontroller, and then scan.
The dynamic scanning scheme saves driving components compared with the static display scheme, but requires the refresh frequency to be higher than 50 Hz to avoid flickering of the displayed image or text. Due to the limitation of the refresh frequency, the number of display elements that can be controlled by a single-chip microcomputer is relatively small.
Now the application of large-screen LED displays has become more and more extensive. In order to achieve orderly and fast display control of hundreds or thousands of LED dot matrix chips, people have used a lot of brains. The dual CPU, dual RAM solution, FPGA solution, etc. have all been successfully applied; but these The display control process of the scheme is still read first and then write.
This scheme has another idea: use one read instruction to complete the reading and writing in one step, which can greatly improve the efficiency of display control, and the circuit is simple.
1. The working principle of LED display
The basic working principle of LED display is dynamic scanning. Dynamic scanning is divided into two ways: row scanning and column scanning. The commonly used method is row scanning. Line scanning is divided into 8 line scanning and 16 line scanning.
In the row scan mode, each LED dot matrix chip has a set of column drive circuits. There must be a latch or shift register in the column drive circuit to lock the font data to be displayed. In the row scanning mode, the row control pins of the same name of the same row of LED dot matrix chips are connected in parallel on a line, a total of 8 lines, and finally connected to a row drive circuit; there must be one in the row drive circuit A latch or shift register is used to latch the row scan signal.
The column drive circuit and row drive circuit of the LED display screen are generally controlled by a single-chip microcomputer, and the commonly used single-chip microcomputer is the MCS51 series. The content displayed on the LED display screen is generally stored in the external data memory of the microcontroller in the form of a font, which is an 8-bit binary number.
The control process of the single-chip microcomputer on the LED display screen is to read first and then write. According to the order of the LED dot matrix chips on the screen, the single-chip microcomputer first drives the latch of the first LED dot matrix chip in the first row, writes the font data read from the external data memory, and then performs the second chip , The third slice... Until the last slice of this row has finished writing the font data, the single-chip microcomputer writes the row scan signal to the row drive latch of this row, so the first row of the first row and the first row of the font data are lit The diode lights up. Then the first row of the second row, the first row of the third row... until the first row of the last row is lit. After the first line of each row is lit, there is a delay for a period of time, and then the screen goes black, so that the single-chip scanning control of one line of the LED display screen is completed.
The scanning control of the second line and the scanning control of the third line of the LED display screen by the single-chip microcomputer... until the scanning control of the eighth line, the process is the same as the scanning control process of the first line. After the control process of all 8 lines is completed, the LED display screen has completed the complete display of 1 frame of image.
Although according to this working method, the LED display is lit up line by line, and only one line is lit at a time, as long as it is guaranteed that each line can be lit more than 50 times per second, that is, the refresh frequency is higher than 50 Hz. The visual inertia, the image displayed on the LED display is still a full-screen stable image.
2. Traditional control method of LED display
Reference [1] summarized and compared the control circuit of the LED display screen. Among them, the display control circuit works in a row scan mode, and the column control circuit is divided into two categories. In the column control circuit, one type uses a chip such as 74LS377 as the latch of the column drive circuit, and the CPU writes data to the latch of the column drive circuit through a parallel bus; the other type uses a shift register such as 74LS595 The chip is used as the latch of the column drive circuit, and the CPU writes modulo data to the latch of the column drive circuit through the serial bus.
Regardless of the parallel bus control mode or the serial bus control mode, the working process is to first assign the data pointer DPTR, and then the accumulator A reads the font data from the external data memory RAM according to the data pointer DPTR. Then, in the case of a parallel bus, assign a value to the data pointer DPTR, and then the CPU writes the font data in the accumulator A to the latch of the LED dot matrix chip column drive circuit according to the point of the data pointer DPTR; in the case of a serial bus, The CPU writes the font data in the accumulator A to the latch of the LED dot matrix chip column drive circuit through the serial port.
In general display control, the MCU that is used more is the MCS51 series. Assuming that the crystal oscillator frequency of the single-chip system is 12 MHz and the machine cycle is 1 μs, it takes more than ten μs for the above two control methods to complete the display control of one LED dot matrix chip.
The high-speed control scheme proposed in this article, it only takes about 4 μs to complete the display control of one LED dot matrix chip. According to this calculation, one MCS51 series single-chip microcomputer can display and control more than 600 LED dot matrix chips. Compared with traditional control methods, the efficiency of display control is doubled.
3. High-speed control scheme of LED display
Figure 1 is the circuit principle of the high-speed control scheme LED display screen. Use MCS51 series single-chip microcomputer to control the LED display; random access memory 62512 is used as the data memory of the LED display to store the font data of the content to be displayed; 8-line scanning mode is adopted, and multiple LED dot matrix chips share a group of row drive circuit; Each LED dot matrix chip has a set of column drive circuit, using 74LS377 as the column drive latch, CPU writes modulus data to the column drive circuit latch through the parallel bus; address decoding circuit is used to generate LED dot matrix The chip select address of the row drive circuit and the column drive circuit.
Figure 1 High-speed control scheme LED display electrical principle
There are two features of this solution: First, although the CPU still writes data to the latch of the column drive circuit through the parallel bus, the latch signal of the latch uses the control signal RD of the CPU instead of conventional usage. WR; Second, the address decoding circuit ensures that the chip select address of the LED dot matrix chip column drive circuit overlaps with the logical address of a certain segment of the data memory, instead of conventional usage, these two sets of addresses must be separated.
Due to some simple changes of the above-mentioned circuits, the display control efficiency of the single-chip microcomputer on the LED display screen will change significantly. The specific working process is as follows: Assuming that the address of the data memory has been loaded into the data pointer DPTR, execute the instruction "MOVXA, @DPTR". The function of this instruction is that the CPU reads the font data from the external data memory according to the DPTR direction, and reads it into the accumulator A; but in this circuit, due to the chip selection address of the LED dot matrix chip column drive circuit and some of the data memory The logical addresses of one segment overlap, that is to say, when the instruction "MOVXA, @DPTR" is executed, the DPTR not only points to an address in the external data memory, but also selects a certain LED dot matrix chip column drive circuit latch Device. If the latch pin of the latch selected at this time happens to have an input pulse, the latch will also lock the font data sent from the external data memory. RD is used for this input pulse. RD is the read control signal sent by the CPU to the external data memory when the instruction "MOVXA, @DPTR" is executed. Because the timing of the read control signal RD and the write control signal WR of the MCS51 series single-chip microcomputer is exactly the same [2], RD replaces WR to achieve the latch function, of course, there is no suspense. When this instruction is executed, the reading of the data memory is completed, and the writing of the LED dot matrix is also completed, thus speeding up the display control process.
As mentioned earlier, in parallel bus, the CPU completes the programming process of writing data to the latch of the column drive circuit of the LED dot matrix. It takes about ten μs; now it only takes 4 μs, which is much faster, because it is now completed. The program process of writing modulo data to the latch of the column drive circuit of the LED dot matrix chip only needs two steps. First, assign an effective address to the data pointer DPTR, and then the CPU reads the modulo data from the external data memory according to the direction of DPTR, and At the same time, the font data is also transmitted to the latch of the LED dot matrix chip column drive circuit. 2 instructions, 4 machine cycles, 4 μs. Here I want to add one point. When programming the latch writing mode data of all LED dot matrix chip column drive circuits, do not use cycle instructions, because each process will have to increase 2 μs; use the LED dot matrix chip The method of programming piece by piece, although the program compiled in this way takes up space, it saves time. The design method of swapping space for time is sometimes a method worth trying for designers.
The latch control of the row drive latch of this circuit still uses the write control signal WR of the CPU, without modification. The chip select signal of the row drive latch also comes from the address decoding circuit. In order to avoid the mutual interference between the data memory and the LED dot matrix chip, this part of the storage space of the data memory corresponding to this group of addresses does not need it.
The design of the address decoding circuit should ensure that the chip select address of the LED dot matrix chip column drive circuit overlaps with the logical address of a certain segment of the data memory. Specific design examples are as follows:
Assume that a certain LED display screen uses 240 LED dot matrix chips, which can display 60 Chinese characters of 16×16, and uses one MCS51 series single-chip microcomputer for high-speed control. There should be 240 chip select addresses for the 240 LED dot matrix chip column drive circuits, and the address decoding circuit must ensure that the effective address after decoding is greater than this number. In the address decoding circuit in Figure 1, the input address signals are A0 to A7 and A11 to A15, and A8, A9, and A10 are not connected. With 74LS138 decoder, 256 effective address lines can be obtained after three-level decoding. The first effective address line corresponds to 8 addresses of external data memory: 0000H, 0100H, 0200H, 0300H, 0400H, 0500H, 0600H, 0700H. The second effective address line corresponds to the 8 addresses of the external data memory: 0001H, 0101H, 0201H, 0301H, 0401H, 0501H, 0601H, 0701H. ...The 256th effective address line corresponds to the 8 addresses of the external data memory: 00FFH, 01FFH, 02FFH, 03FFH, 04FFH, 05FFH, 06FFH, 07FFH. These 256 effective address lines, 240 chip-select addresses for the column drive circuit, and the remaining chip-select addresses for the row drive circuit; if not enough, the row drive circuit can be considered to be controlled by a serial bus. The above analysis results show that the I/O interface address of a LED dot matrix chip and the 8-byte address of the data memory have an overlapping relationship. This is because each LED dot matrix chip has 8 rows, and each row corresponds to 1 byte of font data.
The above analysis results also show that the I/O interface address of all LED dot matrix chips and the 0000H~07FFH address segment of the data memory have established a mapping relationship. What is stored in the data memory 0000H~07FFH is exactly all the font data of one frame of image.
4 Application of high-speed control scheme in LED display
The large-screen LED displays currently used in business use hundreds, thousands or even thousands of LED dot matrix chips. The single-chip microcomputer control of the LED display screen includes three parts: the communication between the single-chip microcomputer and the PC, the data processing of the font data, and the display control. One piece of single-chip microcomputer must communicate with the PC, but also need to carry out data processing, but also to carry out display control, it must be too busy.
In order to solve the control problem of the large-screen LED display, many documents have successfully designed the control scheme. The basic idea of many schemes [36] is that the data processing is completed by a single-chip microcomputer, and the display control is completed by another single-chip microcomputer or a specially designed circuit. Although the control efficiency of these schemes is very high, the circuit is more complicated.
Figure 2 Data memory segment selection switch circuit
The basic idea of this scheme is that the communication, data processing and display control of the single-chip computer and the PC are all completed by a single-chip single-chip. The display control adopts the high-speed control scheme proposed in this article, the circuit is simple, and the display control efficiency is very high. For example, when the LED dot matrix chip adopts the commonly used LED dot matrix chip with an outline size of 6 cm×6 cm, when the screen area is less than 2 m2, one MCS51 series single-chip microcomputer can be completed. However, high-speed control schemes are used for large-screen LED displays, and there are still some problems to be solved:
① The communication problem between the microcontroller and the PC. When the large-screen LED display is connected to a PC, the PC is used to edit the content to be displayed and transmit the content to the single-chip microcomputer in the large-screen LED display. When the PC communicates with the single-chip computer, it will not interfere with the work of the display screen. Because when the display screen is working, it is displayed field by field, and there is a black screen time between fields, and there is no problem in using the black screen time to communicate.
② Increase the problem of showing the number of sessions. Most display screens work in a loop of one field, one field, and another field. The previous design only considered the problem of establishing a mapping relationship between the I/O interface address of the LED dot matrix chip and a segment of the data memory when displaying a frame of image, so only a fixed image can be displayed. Figure 2 is added on the basis of Figure 1, so that the I/O interface address of the LED dot matrix and the multiple segments of the data memory can be mapped. When working, the P1 port controls the multi-channel switch to switch between the different segments of the data memory and the I/O interface address mapping of the LED dot matrix chip, so the display screen can be displayed one by one in a loop. If the number of pieces of external data storage is expanded, and one of them is enabled by the P1 port, then more segments and the I/O interface address of the LED dot matrix will be able to be expanded to establish a mapping relationship. In this case, like pull screen, Some display effects such as running water can be