# Generalized 7 segment LED display driver

**URL:** <https://forum.xod.io/t/generalized-7-segment-led-display-driver/1376>\
**Category:** Look What I’ve Done\
**Created:** [November 16, 2018, 9:57pm UTC](https://forum.xod.io/t/generalized-7-segment-led-display-driver/1376 "2018-11-16T21:57:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bitrex](https://avatars.discourse-cdn.com/v4/letter/b/eada6e/32.png) [@bitrex](https://forum.xod.io/u/bitrex)\
**Post date:** [November 16, 2018, 9:57pm UTC](https://forum.xod.io/t/generalized-7-segment-led-display-driver/1376/1 "2018-11-16T21:57:39Z")

</div>

This is a set of patches for driving common-cathode 7 segment LED numerical display of arbitrary size from a “String” input; strings containing ASCII characters are also supported and will be more-or-less displayed within the limits of a 7 segment display.

Anode lines to all segments of each digit of the digits in the display are connected to the same ports via current-limiting resistors. Cathode port selection is implemented as a variadic patch node where you drag out the box and add as many output port numbers as digits you have and connect each segment’s cathode to those. The digits are multiplexed and scanned at user-defined frequency to reduce pin count.

Longer sequences of numerals or characters are also supported, if the size of the input text exceeds the number of physical characters in the display the text will be scrolled, like one of those LED message boards.

This is a first draft, video clip of it in action will follow along with revisions to follow but it should be more-or-less usable as is currently, I have a 2 digit red LED display up and running on a breadboard scrolling pretty nice right now!

[7SegmentLED.xodball](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/fb11b1c150d17e402cc4fefb063b9b0bab4f1a87.xodball) (25.0 KB)

---

<div class="post-metadata">

**Author:** ![cesars](https://avatars.discourse-cdn.com/v4/letter/c/f05b48/32.png) [@cesars](https://forum.xod.io/u/cesars)\
**Post date:** [November 16, 2018, 10:09pm UTC](https://forum.xod.io/t/generalized-7-segment-led-display-driver/1376/2 "2018-11-16T22:09:35Z")

</div>

It looks great, thanks for sharing 👏 👏

---

<div class="post-metadata">

**Author:** ![bitrex](https://avatars.discourse-cdn.com/v4/letter/b/eada6e/32.png) [@bitrex](https://forum.xod.io/u/bitrex)\
**Post date:** [November 16, 2018, 10:15pm UTC](https://forum.xod.io/t/generalized-7-segment-led-display-driver/1376/3 "2018-11-16T22:15:26Z")

</div>

Thanks, I tried a couple implementations, it still uses a bit more program memory than I’d like, if one doesn’t need to output “l33tspeek”-looking text to the display it can easily be reduced. Have to store the segment-mapping somewhere 🙂

---

<div class="post-metadata">

**Author:** ![bitrex](https://avatars.discourse-cdn.com/v4/letter/b/eada6e/32.png) [@bitrex](https://forum.xod.io/u/bitrex)\
**Post date:** [November 20, 2018, 6:38am UTC](https://forum.xod.io/t/generalized-7-segment-led-display-driver/1376/4 "2018-11-20T06:38:43Z")

</div>

First little problem I’ve noticed that I’m going to try to patch up this week is that there are some small glitches in the display when it’s being sent the output of a counter from a “clock” and just counting up digits, and the behavior on my 2 digit display once the count exceeds the display width and it starts trying to “scroll” three digits to fit a 2 digit display is rather odd.

Pretty sure this is related to the input from the “UPD” node to update the display text, and the Timeout call to update the digit scan being unsynchronized so I’ll have to change the code a bit to synchronize them somehow. Just clearing the current interval timer and starting over when the “UPD” input is fired and the display buffer changed may be enough.

---

<div class="post-metadata">

**Author:** ![bitrex](https://avatars.discourse-cdn.com/v4/letter/b/eada6e/32.png) [@bitrex](https://forum.xod.io/u/bitrex)\
**Post date:** [November 23, 2018, 7:47am UTC](https://forum.xod.io/t/generalized-7-segment-led-display-driver/1376/5 "2018-11-23T07:47:08Z")

</div>

Revision 2 is ready, the first had a number of problems that have been fixed up now, including the glitching display issue. I changed the output nodes to output a pulse when the content of the display buffer changes plus a Text output of what it holds at a given time; this seems more useful for interfacing with other patch nodes than the generic “Done” pulse output when a transaction finishes it had before, you can have an “equals” node set to trigger when a given substring is detected and cause the display to do something else (I’ve done this in the example patch.) I’ve altered and cleaned up the character set a bit currently every letter of the alphablet should be more-or-less representable except for “X” so ah, just don’t use that one. 😉

[XOD 7 segment LED display patch in action](https://www.youtube.com/watch?v=IYa1nR2_4JY)

[7SegmentLED\_rev\_2\_11-22-18.xodball](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/d2c3afb2ea10b37b4d181169ed527e82aaaca146.xodball) (39.4 KB)

---

<div class="post-metadata">

**Author:** ![maksimbaturin](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/maksimbaturin/32/3876_2.png) [@maksimbaturin](https://forum.xod.io/u/maksimbaturin)\
**Post date:** [April 16, 2023, 6:38pm UTC](https://forum.xod.io/t/generalized-7-segment-led-display-driver/1376/6 "2023-04-16T18:38:56Z")

</div>

I’m not good at C++, I can’t check the correctness of the code. An error occurs during compilation.  
Uploading: 20230416\_213057.jpg…

---

<div class="post-metadata">

**Author:** ![marlowepierce](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/marlowepierce/32/3936_2.png) [@marlowepierce](https://forum.xod.io/u/marlowepierce)\
**Post date:** [July 9, 2024, 10:54am UTC](https://forum.xod.io/t/generalized-7-segment-led-display-driver/1376/7 "2024-07-09T10:54:25Z")

</div>

Thanks for sharing, I definitely implementing this.
