The previous section, we describe the single LED and the microcontroller interface circuit and the programming examples, the purpose is to enable beginners to understand the application of LED in microcomputer principles, LED display alone is not much in the practical application purposes, usually a number of the LED display. Now we further study, we have to explain the 8-bit LED display principles and the actual programming. Here we do not have a multi I / O port 8051, instead of using the C51 instruction set is fully compatible with quality and cheap AT89C2051 microcontroller, and its software programming consistent with the C51.
In most applications, we do not want to use multiple I / O port of the microcontroller, in principle, to use as little as possible pin devices. There is no surplus in the case of the port, how we could expand the circuit to achieve the desired purpose? We hope that this example allows designers to understand that in the practical application of the principle of the circuit Kuozhan on the practical application help.
Left is the display circuit, the AT89C2051 15 external I / O pins, namely P1 and P3 ports port, single port P3.6 P3 is not leads to the 15 I / O port to directly drive an 8-bit LED is clearly not enough, we adopted a one-sided 74LS273 to latch the address, if the P1 port is only for display driver, but not exchange data with other peripherals, the latch can be omitted, either directly or through other connected drive circuits to drive the LED. Through a 74LS138 address line three – eight 8-bit LED decoder for time-sharing on gating, so that at any one time, only one LED is lit, but as long as the scanning frequency sufficiently high (generally greater than 25Hz), Since the human visual characteristics of temporary stay, intuitively feel it is a continuous light, and this is what we often say that the dynamic scanning circuit.
This circuit, 74LS273 used to drive LED’s 8-bit segment code, 8-bit LED corresponding “a” – “g” section together, their common terminal connected to the 74LS138 decoder are gated by the 74LS04 reversed after driver output. This election to pass a particular LED, the corresponding address lines (74LS04 output) the output is high, so our selection of LED digital tube LED were positive.
The frequency of the dynamic scan have certain requirements, the frequency is too low, LED will flicker. If the frequency is too high, due to the short time of each LED light, LED brightness is too low, the naked eye can not see, so generally take a few ms is appropriate, which requires the preparation program, a strobe Bit LED lights and keep them some time, the procedure often used is to call delay subroutine. Instruction in the C51, the delay subroutine is quite simple and very easy to change the delay time can be found in process list DELAY delay subroutine.
For simplicity, we just write a synchronous 8-bit LED display, “00000000” – “11111111” until “99999999” figures, and repeated cycles. The procedure is simple flow chart omitted.