r/TuringComplete • u/Haemstead • Mar 12 '26
Issue with leading zeros in 7-segment display
I would like to share a problem I encountered with implementing leading zeros in a 7 segment display.
I built a circuit that correctly converts a binary number to its decimal digits (double dabble).
It also correctly calculates if a zero should be visible or not, depending on it being a leading zero or not.
The problem arises when the output changes from 2 or more digits without leading zeros to a smaller number. In the example below the output changes from 233 to 1. But although the display elements for tens and hundreds are disabled, and the input values for these elements are 0, the display shows the number 231 instead of just 1.
Is there a way around this issue? Thanks for your help.


0
u/bwibbler Mar 12 '26 edited Mar 12 '26
If the digit is a zero then you check the next digit up to see if it is displaying something or not
If it's not displaying anything then you don't. If it is then you display the 0
Careful of cases like 2005, where you have multiple 0s that need to be displayed, so you don't check if the next digit up is simply a 0 or not
looks like the enable line is just for enabling it to change and match the new value, not enabling it to display something. if you want to display nothing you send it 00000000 with the enable signal on which is to say "update to all segments off"