Static LED Display Controlled via SPI

Sunday , 1, June 2008 Leave a comment

Showing on a seven-segment LED display of digital information in a microcontroller based circuits is common, and the developers of such circuits perform it in their each own way. The display module is described below, which may well become a universal solution, which will greatly simplify the development of new devices.

Fig.1 shows the functional diagram of the module. Each seven-segment indicator is controlled by a separate SN74HC595D chip containing:

  • 8-bit shift register;
  • parallel latch;
  • controlled output buffer.
Fig.1. Functional diagram of a universal multi-digit seven-segment LED digital display.

Sequentially loaded into the shift register data bits are applied to the SIN pin (Serial Input). Their fixation in the shift register (gating) occurs by the transition of the pulse signal at the SRCK input from low to high state. When the shift register loading is over, its state is copied and stored by the latch on transition of the special pulse applied to the RCK input from low to high state (see Fig.2). But the outputs of the Q0..Q7 will receive the state of the latch only with a low state at the OE input (Output Enable). Otherwise (OE is in high state), the outputs of the chip are turned off (go to a high-impedance state) and the display goes out. The shift register (but not the latch) can be reset to zero asynchronously (regardless of the SIN and SRCK signals) by applying the low state to the SRST input. The serial connection of the SN74HC595D chips in a chain allows you to increase the number of digits of the seven-segment LED display. In this case, the control signals remain the same, only the number of downloaded data bits increases accordingly.

Fig.2. Loading the code of the number “5” for the indicator with a common anode (see table below).

Fig.3 shows a schematic diagram of such a display module for two of digits. Resistors R1..R5 determine the state of the input signals when the module is disconnected from the microcontroller circuit and serve as a “load” for the module control lines. The quenching resistors R6..R21 determine the current of each segment when it is turned on, which in any case should not exceed the maximum allowable for the outputs of the SN74HC595D chip. Setting jumper J1 to close its midpoint to a common GND wire or a +Vcc power wire allows the use of seven-segment LED indicators in the circuit with both a common cathode and a common anode. Capacitors C1..C3 prevent failures from possible external power supply interference.

Fig.3. Schematic diagram of the display module for two of digits.

Fig.4 shows the appearance of the display module. The module is designed for the use of LED seven-segment indicators manufactured by Kingbright of the SA05-11 series (with a common anode) or SC05-11 (with a common cathode) or similar with a sign height of 12.7 mm. The result is a compact display module, the overall dimensions of which are not much larger than the dimensions of the indicators themselves. It turned out to be not at all difficult to do this, since each SN74HC595D chip in the SOIC-16 package fits under its “own” indicator on the other side of the double-sided printed circuit board. The accordance between the pins of the SN74HC595D chip and the segments of the LED indicator was chosen based on the ease of tracing the printed conductors on the module board. Also, resistors and capacitors of size 0805 are used for surface mounting. PCB dimensions 43,2 x 22,9 mm. Its drawing and installation of elements on it are shown in Fig.5. On the top side of the board, LED seven-segment indicators L1 and L2, resistors R1..R5 and capacitor C1 are installed, and on the bottom side, all other elements are installed: microcircuits D1 and D2, quenching resistors R6..R21, capacitors C2 and C3, and a jumper is also soldered J1.

Fig.4. LED seven-segment indicator for two of digits.

The module operates at a supply voltage of +2.8 V to +5.5 V. The value of the supply voltage and the type of LED indicators also determine the required resistance of the quenching resistors R6..R21 based on the current of one segment within 4…4.5 mA.

Fig.5. Printed circuit board of the display module for two of digits (scale 2:1).

How to connect power and control signals to the display module board is shown in Fig.6. An important advantage of the described module over other indication circuits is the possibility of cascading several such modules into a chain as shown in Fig.7, which can be used, for example, to indicate several digital values ​​once in some device with the same set of control lines. And since there are few of these lines, and the connecting cable between the display module and the microcontroller circuit contains only a few wires, the module can be freely placed in any convenient place in the device case. An example of connecting such an indication module using a cable about 70 cm long is shown in the photo shown in Fig.8. The resistance of the “load” resistors R1..R5 was 10 kOhm and no malfunctions were observed.

Fig.6. Power supply and control signals.
Fig.7. Cascading several display modules into a chain.
Fig.8. An example of placing the display module inside the case of device.

It is most convenient to load information for display into the display module via SPI, which is now equipped with almost all microcontrollers manufactured, for example, by Atmel. Given that the same port is often used for in-circuit programming of microcontrollers, and the connector for this purpose is usually already installed on the board, then connecting the display module to it suggests itself. The accordance of the SPI port signals to the control lines of the display module is illustrated by the diagram in Fig.9. At the end of the sequential loading of information bits into the display module, the microcontroller “latches” them by supplying a pulse to the input of the RCK display module from any of its outputs, conventionally designated as P1 in the schematic diagram. The input of the OE module can be used to turn off the indicator for the time of the start uncertainty of the program executed by the microcontroller. If you apply a pulse signal to this input, then by changing the duty cycle of such a signal, you can adjust the brightness of the indicator.

Fig.9. Connecting the display module (left) to the SPI port of the microcontroller (right).

The SPI mode must be set according to features of the SN74HC595D chip functioning , namely:

  • SPI Master configuration mode;
  • CLK transition from low to high is the first data capture edge.
Fig.10. LED segments and their names.

Character codes

Digit LED display type
Common anode Сommon cathode
0 0x21 0xDE
1 0xEB 0x14
2 0x32 0xCD
3 0x62 0x9D
4 0xE8 0x17
5 0x64 0x9B
6 0x24 0xDB
7 0xE3 0x1C
8 0x20 0xDF
9 0x60 0x9F

The mapping of the segments to the designations in the schematic diagram is shown in Fig.10. If the sequential download of the next byte through the SPI starts with the most significant bit, then the hexadecimal codes accordance to the decimal figures for loading will be as in the table. To light the decimal point (DP segment), perform a logical “OR” operation with hexadecimal number 0x20 for a common cathode indicator or a logical “AND” operation with hexadecimal number 0xDF for a common anode indicator with a downloadable code of decimal figure.

Radio amateurs constructing, for example, radio receivers with a digital scale, can note for themselves another important advantage of such a display module – the extremely low level of radio interference generated. Indeed, unlike schemes with dynamic indication, the need for control pulses on long conductors appears here only to update the numerical value displayed on the indicator. In the intervals between such updates, when the indicator only displays the number in accordance with the last load, that is, for the longest time, no pulses are sent to the circuit at all – the indication is static and there is no radio interference.

Fig.11 shows the PCB trace for an 8-digits LED seven-segment display module. It is easy to notice the “regularity” of the printed circuit board pattern, by applying fragments of which you can create a pattern for the display module for the required digits number already for your needs.

Fig.11. Printed circuit board for an 8-digit LED display module (scale 1:1).

Similarly, you can create modules with larger LED indicators that require both higher current and voltage on one segment. For this purpose, you can take, for example, such a chip as TPIC6595 manufactured by Texas Instruments. It operates in the same way as the SN74HC595D, but its high-power open-drain MOSFET outputs have a load capacity of 250mA at a maximum voltage of 45V.

Copyright © Sergii Zadorozhnyi, 2008

Please give us your valuable comment