In recent years, with the rapid development of the information industry, dot matrix LED displays have been widely used in various advertising and information Display systems such as the financial industry, post and telecommunications industries, stadiums, and advertising industries, and have become an important means of information transmission. The LED writing dot matrix screen introduced in this article can not only be used as an information output device like an ordinary Display screen, but also can be used to input information directly on the LED display screen with a light pen. The ordinary display screen also has a “handwriting” function.

Introduction: In recent years, with the rapid development of the information industry, dot-matrix LED displays have been widely used in various advertising and information display systems such as the financial industry, post and telecommunications industries, stadiums, and advertising industries, and have become an important means of information transmission. The LED writing dot matrix screen introduced in this article can not only be used as an information output device like an ordinary display screen, but also can be used to input information directly on the LED display screen with a light pen. The ordinary display screen also has a “handwriting” function.

1 hardware system design

The overall block diagram of this system is shown in Figure 1, which consists of five parts: keyboard and display module, light pen module, LED dot matrix screen module, STM32 control module, and power supply module.

Design and implementation of LED dot matrix screen based on STM32
Figure 1 Block diagram of the overall scheme

1. 1 core control module

This system uses STM32F103VCT6 as the control core.

STM32 is a 32-bit microprocessor with low power consumption, low interrupt latency, and high performance. The STM32 processor uses instruction prediction and pipeline technology. It fetches, decodes, and executes at the same time. Branch prediction provides a continuous instruction stream to the pipeline. The pipeline can continuously execute effective instructions. Therefore, the speed of STM32 is faster than 8051. Much; STM32 processor’s internal integrated phase-locked loop can achieve a maximum operating frequency of 72MHZ, which provides a basis for achieving high-speed system response (high-speed scanning); its built-in two watchdog timers (independent watchdog and Window watchdog) to make the system more stable[1].STM32F103VCT6 has a 12-bit us-level A/D converter, 9 timers, 2 I2C interfaces, 5 UART interfaces, and 3 SPI interfaces, which provide conditions for future expansion.

1. 2 light pen circuit design

The human eye can distinguish the number of swipes for 24 times. According to experience, the swiping speed of the dot matrix screen of this system is 70 times per second, which is 70Hz, so the response speed of the light pen is required to be greater than 70Hz. The scanning method is every Only one point is on at a time, and the bright spot moves in one direction. At this time, the main control scanning speed is 1M. The dot matrix screen used is 32×32. When the number of refreshes per second exceeds 24 times, the point cannot be seen. The array screen flickers. In this system, the screen is swiped 68 times per second, so the minimum frequency required by the photoelectric device is 68Hz. The phototransistor (3DU33) has high sensitivity and short response time. The pulse output by the phototransistor is shaped and output by 74HC14. The light pen circuit diagram is shown in Figure 2:

Design and implementation of LED dot matrix screen based on STM32
Figure 2 Schematic diagram of light pen principle

1. 3 LED dot matrix screen module

The principle block diagram of the 32 × 32 LED dot matrix screen circuit is shown in Figure 3.

The I/0 port of the STM32 main controller is used as the input control signal of the dot matrix screen module. OE is the enable terminal, CLK is the clock line, LT is the latch signal, DA is the data line, and A, B, C, and D are the rows. Strobe address line[2]The 74HC245 in the circuit acts as a bus buffer. Two 74HC138s form a 4-16 decoder to achieve 16-channel row strobe. The strobe signal is excited by the 4953MOS Transistor as a row drive. The row drive is H1 ~ H16, and each row drive is responsible for it. 32 × 32 dot matrix two-line strobe (for example, H1 controls the 1st and 17th lines, H2 controls the 2nd and 18th lines). The serial data is buffered by 74HC245 and then sent to the cascaded 74HC595 serial-to-parallel conversion There are 8 pieces of 74HC595 designed in the circuit, of which 4 pieces are used for column data conversion from row 1 to row 16, and the other 4 pieces are used for column data conversion from row 17 to row 32.

Design and implementation of LED dot matrix screen based on STM32
Figure 3 Block diagram of LED dot matrix screen circuit

2 Software system design

STM32 series microcontrollers use C language for program design, and the development and debugging environment is Keil MDK. The main program flow chart is shown in Figure 4.

Design and implementation of LED dot matrix screen based on STM32
Fig. 4 main program flow chart

When the system is powered on, the LCD and LED dot matrix screens respectively display their respective boot interface. At the same time, STM32 scans the keyboard.

In any state, press the “Backlight” button to turn on or off the LCD backlight. This function allows the dot matrix screen to be used at will, and the backlight can be manually turned off during the day to reduce power consumption and save energy.

When the “Set” button is pressed, it enters the function selection display interface.

At this time, press the up and down keys to select the function. Enter the functions such as light up, draw light, reverse display, entire screen erase, stroke erase, continuous writing of multiple characters, object dragging, setting sleep time, adjusting brightness and so on. The indicator icon flashes in front of which function, it means that the function is selected, and the dot matrix screen can execute the corresponding function under the control of the system. Under any function, press the “OK” button to display the coordinates of the light pen position. This function can follow the coordinates of the light pen under various functions, so as to quickly determine the position of the light pen.

In the multi-word continuous writing function, after each word is written, press the custom “1” key to store the written word in the corresponding data buffer. After the four words are written, use a light pen to approach the dot matrix screen to give STM32 can display the stored four words one by one in turn with one signal. In order to facilitate writing and speed up writing, after the font is stored, when the light pen is close to the dot matrix screen, the screen will be automatically cleared.In the object drag function, first encircle the object, use the light pen to select the coordinate reference point on the object to drag, determine the relationship between the current coordinates of the light pen and the reference point coordinates, and perform corresponding operations on the data in the RAM area corresponding to the encircled object[4], And then update the coordinate value of the reference point, repeat the above instructions until the end of the object dragging.

Under the brightness adjustment function, the dot matrix screen can automatically change the brightness according to the environment.The operator can also manually adjust according to needs, and maintain the brightness[4].

3 Test plan and measurement results

3. 1 Measuring equipment

The main measurement equipment is a DC stabilized source YB1730, a digital multimeter (FLUKE 15B), a multimeter SJ47100MHz and a dual-channel oscilloscope (TeKtronix TDS2012B). The unit of measurement is a stopwatch with an accuracy of 0.01s.

3. 2 Actual measurement results

3. 2. 1 Light up and erase.

The “light up” mode is shown in Table 1.

Design and implementation of LED dot matrix screen based on STM32
Table 1 “Light up” mode

The result shows: The point bright spot is accurate, and the coordinate display is accurate.

“Erase” mode is shown in Table 2.

Design and implementation of LED dot matrix screen based on STM32
Table 2 “Erase” mode

3. 2. 2 Screen brightness adjustment.

The screen brightness adjustment test is shown in Table 3.

Design and implementation of LED dot matrix screen based on STM32
Table 3 Screen brightness adjustment test

4 Conclusion

This system uses STM32F103VCT6 as the control core, using 74HC245, 74HC595, 74HC138,

74HC04 and 4953 drive 32 × 32 LED dot matrix screen, use a light pen to detect the scan of the LED dot matrix screen to determine the coordinates of the corresponding point, use the touch screen to switch each function and display the current coordinates and function mode. The function test shows that the hardware of this system is stable and the functions are perfect. C language programming is used to realize the automatic lighting, drawing, reverse display, whole screen erasing, stroke erasing, continuous writing of multiple characters, object dragging, and display brightness. Basic functions and functions such as adjustment and automatic shutdown of the screen over time have also realized the innovative functions of “circle drawing” and “filling”. This system realizes the “handwriting” function of the LED display screen with a low cost and a highly logical program. Its function has strong scalability and has a wide range of application prospects.

The Links:   QM75DY24 PM800HSA120