I am using a PIC18F2420 microcontroller (I can change if required). The task is to drive up to 20 Power level indicator LEDs along with a few other LED indicator & switches using PIC. I can imagine connecting the anode of all 20 LEDs to the rail (~ 30V) and connecting cathode of each LED to a PIC I/O pin. But this would mean 20 I/O pins reserved just for this - waste of many I/Os. External I/O expander would add cost and only gives 8 more I/Os with ICs like MCP23008. Cost and PCB real estate is important consideration.. With Charliplexing LEDs, I can only turn ON 1 LED ON at a time. I don't want to drive them at duty cycle with reduced brightness..
How can I drive up to all 20 LEDs ON together with best usage of the PIC I/O pins? Do I really need a controller with so many pins that I have to assign 1 pin for each LED only? LEDs connection scheme drawing would be helpful to understand..
I don't want to turn all 20 LEDs on/off at the same time as a group..These LEDs are level indicators and as per the user input, I need to turn each next level indicator LED ON by keeping all lower level indicators ON as well, as level is increased by user and turn off each highest level LED off one at a time, as level is decreased by the user..