Design engineeringElectricalElectronicsNews

Project: Implementing a 4xN LED driver

by Dialog Semiconductor

LED displays are widely used in systems ranging from digital clocks, counters, timers, electronic meters, basic calculators, and other electronic devices capable of displaying numerical information. Figure 1 depicts an example of a 7-segment LED display which can show decimal numbers and characters. As each segment on the LED display can be controlled individually, this control can require a lot of signals, especially for multiple digits. This article describes an implementation of the LED driver that drives multiple digits with a 2-wire I2C interface from an MCU.

Figure 1: 7-segment LED display

Background

The LED displays are divided into two categories: Common Anode and Common Cathode. In a common anode configuration, the anode terminals are internally shorted together, as shown in Figure 2. To turn ON the LED, the common anode terminal is connected to the system supply voltage VDD, and the cathode terminals are connected to the ground through current limiting resistors.

Figure 2: Common Anode Configuration

A common cathode configuration is similar to a common anode configuration, except the cathode terminals are shorted together, as shown in Figure 3. To turn ON the common cathode LED display, the common cathode terminals are connected to the ground. The anode terminals are connected to the system supply voltage VDD through current limiting resistors.

Figure 3: Common Cathode Configuration

An N-digit multiplexed LED display can be obtained by concatenating N individual 7-segment LED displays. Figure 4 portrays an instance of a 4×7 LED display obtained by combining 4 individual 7segment displays in a common anode configuration.

 4xN LED driver
Figure 4: 4 x 7-segment LED Display

As seen in Figure 4, each digit has a common anode pin/backplane that can be used to enable each digit individually. The cathode pins for each segment (A, B, …G, DP) should be shorted together externally. To configure this 4×7 LED display, it is required 12 pins (4-common pins for each digit and 8-segment pins) to control the 32 segments of the multiplexed 4×7 display.

The IC design, detailed below, shows how to generate the control signals for this LED display. This design can be extended to control up to 4 digits and 16 segments.

Circuit design

Figure 5: Circuit Design

The IC design displayed in Figure 5 includes both the segment and digit signal generation. The segment signals are generated from the ASM, and the digit selection signals are created from the DFF chain. The segment signals are connected to the segment pins through current limiting resistors, but the digit selection signals are connected to the display’s common pins.

Digit signal generation

As described earlier, each digit on a multiplexed display has an individual backplane. The signals for each digit are generated from the internal oscillator-driven DFF chain.

These signals drive the common pins of the display. Figure 6 displays the digit selection signals.

Channel 1 (Yellow) – Pin 6 (Digit 1)

Channel 2 (Green) – Pin 3 (Digit 2)

Channel 3 (Blue) – Pin 4 (Digit 3)

Channel 4 (Magenta) – Pin 5 (Digit 4)

Figure 6: Digit Selection Signals

Segment signal generation

The ASM generates different patterns to drive the segment signals. A 7.5ms counter cycles through the ASM states. As the ASM is level sensitive, this design utilizes a control system to avoid the possibility of rapidly switching through multiple states during the high period of the 7.5ms clock. This specific implementation relies on consecutive ASM states controlled by inverted clock polarities. The same 25kHz internal oscillator generates both the segment and digit signals.

ASM Configuration

Figure 7 describes the state diagram of the ASM. State 0 automatically switches to State 1. A similar switch occurs from State 2 to State 3, State 4 to State 5, and State 6 to State 7. Data from State 0, State 2, State 4, and State 6 are instantly latched using DFF 1, DFF 2, and DFF 7 as shown in Figure 5, before the ASM transitions to the next state. These DFFs latch the data from the ASM’s even states, which enables controlling an extended 4×11/4xN (N up to 16 segments) display using IC’s ASM.

Two states of the ASM control each digit on a 4xN display. State 0/1, State 2/3, State 4/5, and State 6/7 respectively control Digit 1, Digit 2, Digit 3, and Digit 4. Table 1 describes the ASM states along with their respective RAM addresses to control each digit.

Figure 7: ASM state diagram

Each state of the ASM RAM stores one byte of data. So, to configure a 4×7 display, three segments of Digit 1 are controlled by State 0 of the ASM, and five segments of Digit 1 are controlled by State 1 of the ASM. As a result, all segments of each digit on the LED display are obtained by concatenating the segments from their corresponding two states. Table 2 describes the location of each of Digit 1’s segments in the ASM RAM. Similarly, ASM’s State 2 through State 7 respectively include the segment locations of Digit 2 to Digit 4.

Table 1: ASM RAM correspondence with 4×7 LED Display

As seen from Table 2, OUT 3 to OUT 7 segments of State 0 and OUT 0 to OUT 2 segments of State 1 are unused. The IC design in Figure 5 can control a 4×11 display by configuring the OUT 0 to OUT 2 segments of the ASM’s odd states. This design can be expanded to control an extended 4xN (N up to 16 segments) display by using more DFF logic cells and GPIOs.

Table 2: Digit 1 segment connection with ASM RAM

Testing

Figure 8 shows the test schematic used to display decimal numbers on the 4×7-segment LED display. An Arduino Uno is used for I2C communicating with the IC’s ASM RAM registers. For more information on I2C communication, please refer to this source. The common anode pins of the display are connected to the digit selection GPIOs. The segment pins are connected to the ASM through current limiting resistors. The current-limiting resistor sizing is inversely proportional to the brightness of the LED display. It is possible to select the strength of the current limiting resistors depending on the maximum average current of the IC GPIOs and maximum DC of the LED display.

Figure 8: Circuit schematic

Table 3 describes decimal numbers 0 through 9 in both binary and hexadecimal format displayed on the 4×7 display. 0 indicates that a segment is ON, and 1 indicates that the segment is OFF. As shown in Table 3, two bytes are required to display a number on the display. By correlating Table 1, Table 2, and Table 3, the ASM’s RAM registers can be modified to display different numbers on the screen.

Table 3: ASM RAM configuration

Table 4 describes the I2C command structure for Digit 1 on the 4×7 LED display. The I2C commands require a start bit, control byte, word address, data byte, and stop bit. Similar I2C commands can be written for Digit 2, Digit 3, and Digit 4.

Table 4: I2C structure

For example, to write 1234 on the 4×7 LED display, the following I2C commands are written.

[0x50 0xD0 0xF9 0xFF]
[0x50 0xD2 0xFC 0xA7]
[0x50 0xD4 0xF8 0xB7]
[0x50 0xD6 0xF9 0x9F]

By repeatedly writing all eight bytes of the ASM, it is possible to modify the displayed pattern. As an example, a counter code is included in the ZIP file that can be found here.

Conclusions

To sum up, the illustrated project presents an IC design aimed to create a compact and power-saving solution for the 4xN LED driver. In the majority of cases, MCUs have a limited number of GPIOs, so offloading the LED driving GPIOs to the IC saves IOs for additional functionalities. The ASM RAM can be easily modified due to the specific preferences using the available design file. By configuring the ASM as described in this article, it is possible to control four N-segment LED displays with up to 16 segments each.

Note: The design file created in the GreenPAK Designer Software can be found here.

You may also like: