Using a single MCU port pin to drive a multi-digit display

When we design a microcontroller (MCU) project, we normally leave a few port lines unused, so that last-minute requirements canContinue Reading The post Using a single MCU port pin to drive a multi-digit display appeared first on EDN.

When we design a microcontroller (MCU) project, we normally leave a few port lines unused, so that last-minute requirements can be met. Invariably, even those lines also get utilized as the project progresses.

Imagine a situation where you have only one port line left out, and you are suddenly required to add a four-digit display. (Normally, you need 16 output port lines to drive four-digit displays or 8 port lines to drive multiplexed four-digit displays). In such a critical situation, the Figure 1 circuit will come in handy.

Figure 1 A MCU single port pin outputs a reset pulse first and then a number of count pulses equal to the number to be displayed.

Figure 1’s top left portion is a long pulse detector circuit, a Design Idea (DI) of mine published in October 2023. For the components selected, this circuit outputs a pulse only when its input pulse width is more than 1 millisecond (ms). For smaller pulses, its output is LOW.

Wow the engineering world with your unique design: Design Ideas Submission Guide

Figure 1’s circuit can be made as an add-on module to your MCU project. When a display update is needed, the MCU should send a 2-ms ON and 2-ms OFF reset pulse once. This long pulse resets the counter/ decoders.

Then, it sends 0.1-ms ON and 0.1-ms OFF count pulses, whose number equals to the four-digit number to be displayed. For example, if a number 4950 is to be displayed, the MCU will send one reset pulse followed by 4950 count pulses once. Then, the MCU can continue its other functions

The long pulse detector circuit with Q1, Q2, and U1A outputs a pulse for every input pulse, whose ON width is more than 1 ms. At the start, the MCU outputs a LOW. This turns Q1 OFF and allows Q2 to saturate, discharging C1.

When a 2-ms pulse comes, Q1 gets saturated, and Q2 turns OFF. During this period, C1 starts charging through R3, and its voltage goes to around 1.8 V. This is then sent to the positive input of the U1A comparator. Its negative input is kept at 1-V as decided by the R4, R5 divider. Hence, U1A comparator outputs HIGH, which resets all the counters.

For smaller pulses, this output remains LOW. So, when the MCU sends one reset pulse, U1A outputs a HIGH, which resets the U2,U3,U4, and U5 counter/decoders.

Then, these counters count the number of count pulses sent next and display it. U2 -U5 are counter / 7-segment decoders to drive common cathode LED seven-segment displays.

For a maximum count of 9999, the display update may take around 2 seconds. This time can be reduced by reducing the count pulse duration, depending upon the MCU and clock frequency selected. 

I have used one resistor for each display for brightness control (R7, R8, R9, and R10). This will not give an equal brightness to all seven segments. Instead, you may use seven resistors per display or a resistor network per display to have equal brightness.

This idea can be extended to any number of displays driven by a single MCU port line. For more information, watch my video explaining this design:

Jayapal Ramalingam has over three decades of experience in designing electronics systems for power & process industries and is presently a freelance automation consultant.

Related Content

The post Using a single MCU port pin to drive a multi-digit display appeared first on EDN.

What's Your Reaction?

like

dislike

love

funny

angry

sad

wow