Seems like I am running out of I/O pins. I only have 6x 8bits pins (need 8 with multiplexing), and I want to power 5x 8 by 8 and 2x 7-seg displays. I don't want to use another ic. so is there a way?
1 Answer
So is there a way?
At first I though not but if the displays can withstand reverse polarity on the X and Y pins the scheme below might work.
Figure 1. Swapping rows and columns on two of the displays may permit controll of four displays with only three ports.
This description assumes that the displays are arranged in rows and columns and that the LEDs are lit by pullig a row HIGH and a column LOW.
- To light the first matrix set each PORT0 row HIGH in turn and pull the relevant bits of PORT1 LOW to light the required LEDs in that row. Rows that are not active should be tri-stated to open and not pull LOW.
- To light the second matrix set each row LOW in turn and set bits of PORT 1 HIGH to turn on the required LEDs in that row. Again, unused rows should be tri-stated to open.
- The third and fourth matrix are controlled in the same way by PORT0 and PORT2.
So far we've used three ports and saved two.
The four-digit displays can be treated as one by connecting the eight segments to PORT0 and the 4 + 4 digit select lines to PORT3. Four ports used.
If you now connect matrix 5 in reverse (as we did with matrix 2 and 4) between PORT0 and PORT3 you would be finished. Still only four ports used.
This technique is known as Charlieplexing.
It's clever, but will it really work? The 8x8 led matrix has 64 LED. to light it up, it needs multiplexing anyway. when connected in reverse, won't doing multiplexing on the first led display accidentally turn on the second one?
Figure 2. Sample of switching on top left LED of DISP1. Note tri-state switches on PORT0 and PORT1.
Figure 3. Charlieplexing sneak paths.
Figure 3 shows a potential problem with sneak paths through multiple LEDs in the other display. The sneak path has three LEDs in series (shown in orange) but the LED shown green will limit the voltage so that the others don't light. With a large number of parallel displays the leakage current may become significant.
Note that to turn on the LED shown in Figure 2 the required outputs will be
PORT0 1xxx xxxx
PORT1 0xxx xxxx
where 'x' is tri-state open/disabled.
-
\$\begingroup\$ Add two more displays in the same fashion but connected to Ports 1 & 2. FWIW - this technique is often called "Charlieplexing". \$\endgroup\$ Commented Jun 3, 2016 at 23:12
-
\$\begingroup\$ Um, I've accounted for all seven displays in the OP's question and I referenced and linked Charlieplexing on the last line. \$\endgroup\$ Commented Jun 3, 2016 at 23:32
-
\$\begingroup\$ It's clever, but will it really work? The 8x8 led matrix has 64 LED. to light it up, it needs multiplexing anyway. when connected in reverse, won't doing multiplexing on the first led display accidentally turn on the second one? For example, if I want to turn on 2 corner leds from first display, I will use port1=0b10000001, port0=0b01111110; this will also switch on second display. \$\endgroup\$– user83582Commented Jun 3, 2016 at 23:41
-
\$\begingroup\$ I think not. Read my tri-state points again. You would be putting out 0b1xxxxxx1 and 0b0xxxxxx0. i.e., The 'x' outputs are floating they are neither pulled high or low. You need to look out for sneak paths through all the "off" LEDs. Are there any? \$\endgroup\$ Commented Jun 4, 2016 at 9:12