by k-ww » January 18th, 2013, 3:16 pm
Assumption: you are running this from either 50Hz or 60Hz power [thru a transformer].
I would design the circuit as follows: [I have used this type of circuit to run 7 segment displays on a light dimmer project].
Use a micro that has at least 18 I/O pins. use one input pin to sync to the 50/60Hz [use a center tapped transformer driving a full wave bridge circuit with the + of the bridge to the power supply [filter cap and 3.3V or %v regulator], and the - of the bridge to the 50/60Hz [100/120Hz pulses] circuit. This circuit can be implimented by a transistor, the base pulled high to the positive voltage by a resistor, and pulled low via another resistor to the - pin of the bridge. Connect the transistor's emitter to ground, pull the collector up witha resistor, and connect the collector to an input pin on the micro. The transistor's collector will go high just before till just after the AC power goes thru zero crossing.
use two 8 bit output ports to drive a 8x8 led array, with 8 current limiting resistors. one port's bits are normally low, connect thru the resistors to 8 groups of 8 LEDs anodes [X] with one pin driving high to select an 8 LED"X" group. The second port's bits are normally high, connected to 8 groups of LEDs cathodes, with one bit going low to select an 8 LED "Y" group.
Connect the free input bit to a pullup resistor, and then to the anodes of 8 signal diodes. connect each diode's cathode to one of the "Y" output port bits. This gives you 8 switches you can read as you scan the LEDS.