RGB color mode is a color standard in industry. It obtains all kinds of colors by changing the three color channels of red (R), green (G) and blue (B) and their superposition. RGB is one of the most widely used color systems. However, most of the RGB controllers in the market are high-end controllers, which have high main frequency and high price. For the middle and low-end users, the cost is high. Therefore, the author designs a low-cost RGB controller based on STC12 series MCU, which can meet the needs of middle and low-end applications. Most of the current monitors use the RGB color standard.
On the monitor, the color is generated by the electronic gun on the screen’s red, green and blue tricolor. The current computer can display 32 bits of color, and there are more than ten million colors.
All colors on the computer screen are made up of three different colors of red, green and blue. A group of red, green and blue is the smallest display unit. Any color on the screen can be recorded and expressed by a set of RGB values. Therefore, this red green blue is also known as the tricolor light. In English, it is R (red), G (green) and B (blue).
The so-called “number” of RGB refers to brightness and is expressed in integers. Usually, RGB has 256 levels of brightness, which is represented by numbers from 0, 1, 2… to 255.
Note that although the highest number is 255, 0 is also one of the values, so there are 256 levels. It’s 11 years from 2000 to 2010. According to the calculation, the RGB color of 256 level can combine about 16.78 million kinds of colors, that is 256 x 256 x 256 = 1677 7216. Usually also referred to as 16 million colors or thousands of colors. Also known as 24-bit color (2 to the 24th power). In the field of led, three-in-one array full-color technology is used, that is, a full-color pixel is composed of RGB tricolor wafers in a light-emitting unit. With the continuous maturity of this technology, LED display technology will bring more rich and real color feelings to people. According to the actual needs, the author designs a low-cost RGB controller for middle and low end users. The whole system is divided into two parts: hardware and software. This design uses STC company’s STC12C5A60S2 single-chip computer, the market price is about seven or eight yuan, can cooperate with higher frequency crystal oscillator, so that the single-chip computer operating frequency is higher than the ordinary 51 single-chip computer.
The refresh frequency of the lattice screen meets the design requirements, and the human eye can not see the obvious flicker. In addition, the design is compatible with wired and wireless word-correcting methods. Under the wired mode, the controller adopts ch340USB serial port chip, and the baud rate is 9600. In wireless mode, Bluetooth 3 can use mobile phones or other Bluetooth enabled handheld devices to change display contents. The cost of RGB lattice is reduced.
The hardware frame diagram is shown in Figure 1, the circuit diagram of RGB controller is shown in Figure 1, and the controller PCB is shown in Figure 3. The hardware part includes the smallest single-chip computer system composed of clock, power supply and reset circuit. The communication part consists of USB serial port circuit and Bluetooth module. The standard HUB75 interface is used to connect with dot matrix screen, and the HUB75 port has cascade capability. In this design, parallel port driver is used for line scan driver, while serial port driver is used for field scan driver. Although 32 * 64 dot matrix display has 32 lines, it can be divided into two 16 * 64 dot matrix screens, two common line selection ports, independent R, thermostatic element G, B interfaces. In order to make full use of the MCU interface, a 4-16 line decoder is added to the dot matrix screen.
Its input is a hexadecimal code, and the decoding output is a low-state scanning signal. In HUB75B interface, A, B, C and D are input pins, which will form 16 different input states, and then control only one output in each state. The design of the field scan driver circuit can be stored as data by using the universal integrated circuit 74HC595 in series and in parallel.
74HC595 is a shift register with eight-bit serial input and three-state parallel output. SI is the input of serial data, RCK is the input clock of storage register, SCK is the input clock of shift register, Q’H is the output of serial input data, G is the output enabling control of input data, and QA-QH is the parallel output of serial input data.
The input data from SI port can be input to 74HC595 by the rising edge of SCK foot of shift register, and the input data can be locked in 74HC595 by the rising edge of RCK foot, so that when G is low level, the data can be output in parallel. The software design flow chart of the system is shown in Figure 4. The main function of the software system is to provide display data to the screen, which is used to generate various control signals to display the screen according to the control requirements. Software design includes display and communication. The display part mainly controls the information transmission function of the content (text, data) to display correctly. The whole system adopts dynamic scanning mode. Real-time communication with PC or mobile terminal is mainly to receive and send data information by interrupting serial port of MCU.
The host computer sends instructions to the controller to change the display content through the serial port. Four eight-bit data constitute a communication instruction. For example, the upper computer sent the instruction of “01 02 XX XX”, the corresponding display information is the content of the second string displayed on the first lattice screen, and the latter two data are user-defined data. The debugging interface of host computer and mobile terminal is shown in the following figure, the serial port baud rate is 9600,8 bit data bits and one stop bit. In the process of debugging, suppose that the design is used as a commodity price tag in supermarkets, and the content and price of the display can be changed by mobile phone or upper computer. As shown in the following figure, the controller cascades three RGB lattice screens, which can be independently displayed and run stably, and achieves the desired design purpose.
At present, most of the high-end RGB controllers in the market are compatible with a variety of communication modes, and the chips have high main frequency, but they are often expensive. However, this design is low-cost, suitable for middle and low-end RGB users, and compatible with wired and wireless ways to modify display content, single-chip high frequency, fast sweep speed, has a good application prospect and market value.