There are many ways to multiplex LED’s. Some don’t use external circuits some do, however they either take a lot of pins or require custom LED layout. Decaplexing would require one IC, one capacitor and three resistors. It would also allow a four character seven segment to use 5 I/O pins. Decade counters are easy to find online for 79 cents
Step 1: Building the Circuit
It looks a little confusing at first but its really not. The PIC12F629 is the most basic microcontroller I know of and is in this circuit to demonstrate the multiplexing ability.
It is not critical which decade output the segments are on, the Q's can go to the closest segment pin. (I like Q0 to go to G so its dual line at start up) The most important part is the two resistors and cap in the middle, they make an auto reset so the decade starts at Q0 at startup. I've included a labeled segment display.
Step 2: Programing
Programming the circuit can get hairy. CHR1 and CHR2 are the anode return pins and SEGAVD is the pin hooked to the decade clock. The best structure is a loop with if statements that turn on a segment for a given number set:
If num1<>1 and num1<>7 and num1<>0 or num1>9 or num1<0 then set CHR1 Low
Will turn the G segment on before the first clock pulse.
DLY was 1ms for approximately 50 Hz refresh rate
Step 3: Future Uses
Decaplexing could drive a 7x5 Led matrix with only 6 I/O pins, strait off the shelf. An 8x8 matrix with 9 I/O pins, but with a Decade counter sourcing and one sinking it would take 3 pins for up to a 10x10 matrix! (Dualdecaplexing) It would take a fast MCU though. It can also be used to multiplex inputs, by counting the Q the counters on it could switch through 10 buttons with 2 I/O pins
Step 4: Specs and Troubleshooting
Refresh Rate: depends on MCU and counter but could be 200+ Hz
The first picture is 39 the number I wanted but if it fails to reset its segments light differently on start up and it then displays NA. This is also caused when only the MCU loses power (like if it’s loose in its socket)
If one segment is lit when others are then it’s on the Q5-9 pin. This pin is on from Q5 to Q9 and will cause double light.
If the display is freaking out, and pulsing all segments then an input (CP0 CP1 or MR) is improperly tied to ground
Any program errors you can email me for assistance
We have a be nice policy.
Please be positive and constructive.