update on 17-08-2014
Hardware

MCU

PIC18F4620

To manage all the I/Os and the different peripherals with the right speed and, first of all, with an exact timing you need to have the full control of the hardware. The MCU must drive a 100Hz scanning on 10 lines (i.e.: 1ms timing) while exchanging data via I2C bus with Real Time Clock and serially with WiFLy. This is possible only using correctly this PIC's features, i.e.: the peripherals and their interrupt, managing the interrupt priority with care.

A well known and experimented PIC18F4620 at 10 MIPS is the right compromise between power and complexity

Almost all of this 40 pin version are used for the rows and columns driving, the I2C bus, serial RX and TX, quartz oscillator, heart-beat LED and ICSP.

*------Port A
* RA0=LDR An.
* RA1 = Row 0
* RA2 = Row 1
* RA3 = Row 2
* RA4 = Row 3
* RA5 = Row 4
*------Port B
* RB0 = INT 0
* RB1 = Row 7
* RB2 = Row 8
* RB3 = Row 9
* RB4 = _____
* RB5 = LED y
*------Port C
* RC0 = Row 5
* RC1 = Row 6
* RC2 =______
* RC3 = I2C C
* RC4 = I2C D
* RC5 = Col L
* RC6 = -TX--
* RC7 = -RX--
*------Port D
* RD0 = Col A
* RD1 = Col B
* RD2 = Col C
* RD3 = Col D
* RD4 = Col E
* RD5 = Col F
* RD6 = Col G
* RD7 = Col H
*------Port E
* RE0 = Col I
* RE1 = Col J
* RE2 = Col K

The serial TX toward WiFly is level adapted from 5.5V to 3.3V with a resistor divider.