Since we can source a maximum of 20mA per pin for PORTB and total maximum source
current of PORTB is 100mA, hence we can use PORTB to drive LED display directly.
As shown circuit below, One Common Cathode 5 x 7 Matrix LEDs are connected to
Port B with 120 Ohms current limiting resistor. The Columns are activated by Q1,
Q2, Q3, Q4 and Q5 respectively by logic high of PA0, PA1, PA2, PA3, PA4 which
switch on gnd to the respective common cathode pins.
The following code,
demonstrate how to drive a 5 x 7- Matrix LED. The program first display one 5 x 7 pattern on the LEDs
and then redisplay this pattern over and over again.