LED digital tube static display interface and programming analysis

In a single-chip microcomputer system, LED digital digital tube displays are often used to display various numbers or symbols. Due to its clear display, high brightness, low voltage and long life, it is widely used.

Remember the "matchstick game" we played when we were young? Several matchsticks can be combined to form a variety of graphics, and LED digital tube displays are actually such a thing.

Eight-segment LED digital tube display

SCM static display interface

The eight-segment LED digital tube display consists of eight LEDs. The seven long strips of light-emitting tubes in the base are arranged in a "day" shape, and the other point-shaped light-emitting tube is used as a decimal point in the lower right corner of the digital tube display, which can display various numbers and partial English letters. LED digital tube display has two different forms: one is that the anodes of eight LEDs are connected together, which is called the common anode LED digital tube display; the other is that the cathodes of the eight LEDs are connected. Together, it is called a common cathode LED digital tube display.

The name and arrangement position of each stroke segment of the LED digital tube display of the common cathode and the common anode structure are the same. When the diode is turned on, the corresponding stroke segment is illuminated, and the various characters displayed by the combination of the illuminated stroke segments. The eight stroke segments hgfedcba correspond to one byte (8 bits) of D7 D6 D5 D4 D3 D2 D1 D0, so that the 8-bit binary code can be used to represent the glyph code of the character to be displayed. For example, for a common cathode LED digital tube display, when the common cathode is grounded (zero level) and the anode hgfedcba segments are 0111011, the digital tube display displays a "P" character, that is, for a common cathode LED digital tube display, "P The glyph of the character is 73H. If it is a common anode LED digital tube display, the common anode is connected to a high level, and the glyph code of the "P" character should be 10001100 (8CH). It must be noted here that many products are convenient for wiring, and often do not follow the rules to correspond to the relationship between fields and bits. At this time, the font code must be designed according to the wiring. We will give a routine later.

In the single-chip application system, the digital tube display shows two commonly used methods: static display and dynamic scan display.

The so-called static display means that each digital tube display must occupy a separate latching I/O interface for the stroke segment glyph code. In this way, the MCU only needs to send the glyph code to be displayed to the interface circuit, and it does not need to control it until the new data is to be displayed, and then sends a new glyph code. Therefore, the overhead of the CPU in the MCU is small. There are many I/O interface circuits that can be individually latched. Here, a common serial-to-parallel conversion circuit 74LS164 is taken as an example to introduce a common static display circuit, so that everyone has a certain understanding of static display.


The MCS-51 single-chip serial port mode is moved to the register mode. The external 64-chip 74LS164 is used as the static display interface of the 6-bit LED digital tube display. The RXD of the 8031 ​​is used as the data output line, and the TXD is used as the shift clock pulse. The 74LS164 is a TTL unidirectional 8-bit shift register that enables serial input and parallel output. Among them, A and B (1st and 2nd feet) are serial data input terminals, 2 pins are input signals according to logic and operation rules, and one input signal can be connected in parallel. T (pin 8) is the clock input that can be connected to the TXD end of the serial port. When the rising edge of each clock signal is applied to the T terminal, the shift register shifts by one bit. After 8 clock pulses, the 8-bit binary numbers are all shifted into the 74LS164. R (pin 9) is the reset terminal. When R=0, the shift register bits are reset to 0. Only when R=1, the clock pulse will be active. The parallel output terminals of Q1...Q8 (3-6 and 10-13 pins) are respectively connected to the corresponding pins of the hg---a segments of the LED digital tube display. About 74LS164 can also be introduced as follows: the so-called clock pulse end, in fact, is the need for high, low, high, low pulse, no matter how this pulse comes, for example, we use the root wire, one end connected to T, one end with the hand It is connected to the high level and the low level respectively, which is also the clock pulse. At the instant when the 74LS164 obtains the clock pulse (more clearly, it is at the edge of the pulse), if the data input terminal (the 1st and 2nd pins) ) is high, then there will be a 1 into the 74LS164 internal, if the data input is low, then there will be a 0 into its internal. After giving 8 pulses, the first data that first enters 74LS164 reaches the highest bit, and then what happens after another pulse? Another pulse, the first pulse will be displaced from the highest, just like the station queued to buy tickets, the railings are so long, to enter a person from behind, in front must go out from the front of a talent line.

To figure this out, let's look at the circuit. Six 7LS164 end-to-end strings are connected, and the clock terminals are connected together. Thus, when 8 pulses are input, the data output from the RXD terminal of the microcontroller enters the first slice. 74LS164 is in the middle, and when the second 8 pulses arrive, the data enters the second 74LS164, and the new data enters the first 74LS164, so that when the sixth 8 pulses are completed, the first time The sent data is sent to the leftmost 164, and other data appear in the first, second, third, fourth, and fifth 74LS164. There is a problem. When the first pulse arrives, what are the other slices in addition to the data received in the first 74LS164? They are also receiving data because their clock terminals are all connected together, but the data has not yet been sent to other slices. What data are they receiving?

In fact, the so-called data is just a saying. Actually, the level is high. When the first pulse arrives, the first slice 164 is actually receiving data from the MCU, and the other slices are also received on the previous Q8. The Q8 is a wire. In a digital circuit, it can only have two states: low or high, that is, "0" and "1". So its next 74LS164 is equivalent to receiving data. All that is received is 0 or 1. This question is here to explain that there may be friends who disdain, and some friends may still be unclear. This actually involves the essential problem of numbers. If you don't understand, please think carefully and find some digital circuits. To understand the working principle of 164, then look at this issue. Be sure to understand, understand this, your level is higher than the start of the learner, can be described as the beginner.

Entrance: The numbers to be displayed are respectively placed in 6 units of the display buffer 60H-65H, and correspond to the respective digital tubes LED0-LED5.

Exit: The 6 digits preset in the display buffer are displayed as corresponding display font codes, and then output to the digital tube display for display.

The single-chip LED display program is as follows:

DISP: MOV SCON, #00H ; Initialize serial port mode 0

MOV R1, #06H ; display 6 digits

MOV R0, #65H ; 60H-65H is the display buffer

MOV DPTR, #SEGTAB; the entry address of the font table

LOOP:

MOV A, @R0 ; take the highest level of data to be displayed

MOVC A, @A+DPTR ; look up the table to get the glyph code

MOV SBUF, A; send serial port display

DELAY: JNB TI, DELAY; waiting to be sent

CLR TI; clear send flag

DEC R0 ; the pointer moves down one bit, ready to take off the number to be displayed

DJNZ R1, LOOP; until all 6 data is displayed.

RET

SETTAB: ; glyph table, introduced in front, we will introduce the production of glyph table in the future.

DB 03H 9FH 27H 0DH 99H 49H 41H 1FH 01H 09H 0FFH

; 0 1 2 3 4 5 6 7 8 9 blanking code

MCU shows the main program for testing

ORG 0000H

AJMP START

ORG 30H

START: MOV SP, #6FH

MOV 65H, #0

MOV 64H, #1

MOV 63H, #2

MOV 62H, #3

MOV 61H, #4

MOV 60H, #5

LCALL DISP

SJMP $

If it is arranged according to the digital tube shown in the figure, the above main program will display 543210. If you want to see 012345, how to send the number?

Let's analyze the production of the glyph table. Let's look at the above "standard" graphics. Write the corresponding relationship between data bits and glyphs and arrange a table as follows (set to a common positive type, that is, when the corresponding output bit is 0, the pen segment is bright)

How, the glyph table will do, it is like this, a table, according to the requirements (0 bright or 1 bright) write the corresponding bits 0 and 1, it becomes. Do an exercise and write the AF glyph code.

If the order of the wiring is disturbed for the convenience of wiring, how should the glyph table be connected? It's also very simple, the same list. Take the new experimental board as an example, the common type. The wiring is as follows:

P0.7 P0.6 P0.5 P0.4 P0.3 P0.2 P0.1 P0.0

CEHDGFAB

The glyph code is as follows:

;0 00101000 28H

;1 01111110 7EH

;2 10100100 0A4H

;3 01100100 64H

;4 01110010 72H

;5 01100001 61H

;6 00100001 21H

;7 01111100 7CH

;8 00100000 20H

;9 01100000 60H

As an exercise, everyone wrote the glyph code for AF.

Originally here is the static interface of the single-chip digital tube display, which should be considered to be over, but I would like to talk about the essence of the number mentioned above. There are some terms and nouns in the MCU that help us understand things, but sometimes we are confused by the relevant semantics of these terms, so that we can not further recognize their essence, and thus generally fall into a state of confusion. Only by deeply understanding the working characteristics of the 74LS164 can you truly understand what serial data is.

Screen Protector For OPPO

A TPU Screen Protector made of the super toughness of the honeycomb structure. Its unique ultra-soft properties allow it to cover the most complex curves and contours in a device.

The self-healing design of the Hydrogel Screen Protector can protect the display screen of the device from damage, leave no air bubbles, and maintain the sensitivity of the touch screen. Advanced anti-fingerprint and dust- and oleophobic overlays keep your screen smudge- and dirt-free. This overlay is also important in providing maximum touch sensitivity for improved high-speed glide and optimal touch response.

The optical transparency of the Hydrogel Film is more than 90%, showing you the most original screen color and bringing the most realistic visual experience.

If you want to know more about the product information of the Hydrogel Screen Protector for OPPO, please click the product details to view the parameters, model, picture, price and other information of the OPPO Screen Protector.
Whether you are a group or an individual, we will do our best to provide you with accurate and comprehensive information about Hydrogel Screen Protectors!

Screen Protector For OPPO,Hydrogel Screen Protector for OPPO,TPU Screen Protector for OPPO,Hydrogel Film for OPPO,OPPO Screen Protector

Shenzhen Jianjiantong Technology Co., Ltd. , https://www.hydrogelprotectivefilm.com