Maker Pro

How to Create a 4xN LED Driver


Check out how to control four 7-Segment LED displays using a GreenPAK SLG46537 IC

Below we described steps needed to understand how the solution has been programmed to create the 4xN LED driver. However, if you just want to get the result of programming, download GreenPAK™ Designer software to view the already completed GreenPAK Design File. Plug the GreenPAK Development Kit to your computer and hit the program to design the device.

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 that 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 project describes a GreenPAK - based implementation to drive multiple digits with a 2-wire I2C interface from an MCU.

Figure 1 7-segment LED Display.jpg


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 ground through current limiting resistors.

Figure 2 Common Anode Configuration.jpg

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 ground and the anode terminals are connected to the system supply voltage VDD through current limiting resistors.

Figure 3 Common Cathode Configuration .jpg

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

Figure 4 4 x 7-segment LED Display.jpg

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

The GreenPAK 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. Please see the References section for a link to the GreenPAK design files available on Dialog's website.

GreenPAK Design

Figure 5 GreenPAK Design .jpg

The GreenPAK design displayed in Figure 5 includes both the segment and digit signal generation in one design. 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 common pins of the display.

Digit Signal Generation

As described in the section "Background" above, each digit on a multiplexed display has an individual backplane. In GreenPAK, 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 .jpg

Segment Signal Generation 

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

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 even states of the ASM, which enables the user to control an extended 4x11/4xN (N up to 16 segments) display using GreenPAK's ASM. 

Each digit on a 4xN display is controlled by two states of the ASM. 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. 

Each state of the ASM RAM stores one byte of data. So, to configure a 4x7 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. In a similar way, ASM's State 2 through State 7 respectively include the segment locations of Digit 2 to Digit 4.

Figure 7 ASM State Diagram.jpg
table 1.jpg

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 GreenPAK design in Figure 5 can control a 4x11 display by configuring the OUT 0 to OUT 2 segments of all odd states of the ASM. This design can be further expanded to control an extended 4xN (N up to 16 segments) display by using more DFF logic cells and GPIOs.

table 2.jpg


Figure 8 shows the test schematic used to display decimal numbers on the 4x7-segment LED display. An Arduino Uno is used for I2C communicating with the GreenPAK's ASM RAM registers. For more information on I2C communication, please refer to AN-1092. 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. The user can select the strength of the current limiting resistors depending on the maximum average current of GreenPAK GPIOs and maximum DC current of the LED display.

figure 8 circuit schematic.jpg

Table 3 describes decimal numbers 0 through 9 in both binary and hexadecimal format to be displayed on the 4x7 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 user can modify the ASM's RAM registers to display different numbers on the screen.

table 3.jpg

Table 4 describes the I2C command structure for Digit 1 on the 4x7 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 .jpg

For example, to write 1234 on the 4x7 LED display, 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, the user can modify the displayed pattern. As an example, a counter code is included in the ZIP file of this project


The GreenPAK solution described in this project enables the user to minimize cost, component count, board space, and power consumption. 

Most of the times MCUs have a limited number of GPIOs, so offloading the LED driving GPIOs to a small and inexpensive GreenPAK IC enables the user to save IOs for additional functionalities. 

Moreover, GreenPAK ICs are easy to test. The ASM RAM can be modified with a click of a few buttons in the GreenPAK Designer Software, which indicates flexible design modifications. By configuring the ASM as described in this proejct, the user can control four N-segment LED displays with up to 16 segments each.

Related Content


You May Also Like