In this project,I use 2 Maxim
7221 in order to drive 70 leds.The leds have been placed in
2 7x5 blocks.In this way it is possible to display easily
numbers,letters and bitmap.You can change the code for your
purpose.With only 3 pic' pins,it is possible to light the
leds in the way you prefer.As example of pic and 7221 flexibility,I
have made some simple programs:digital counter and digital
clock with temperature sensor.All the programs has been written
with Melabs
Pic Basic Compiler PRO (PBP).In case you don't have PBP,I
have uploaded also the compiled versions in hex format so
you have just to program your pic with your preferred programmer.The
compiled Hex files are for PIC16F84A@4Mhz and PIC16F628@4Mhz(internal
oscillator selected by default so you needn't the XTAL and
the 2 capacitors in the F628 version).

Click on the pictures for details.


PIC 16F84A and PIC 16F628 LAYOUT
PIC16F84A (1Kwords data memory) and PIC16F628
(2Kwords data memory)are pin to pin compatible. PIC16F628
has analog comparators so you have to set PORTA to digital.
In PBP add,at the start of your program,the line:
CMCON = 7 'all ports are set to digital in
F628
The fonts (in my examples are numbers) are stored
into PIC's internal EEPROM during programming with the following
code:
Data %00011100,%00010100,%00010100,%00010100,%00011100
'0
Data %00001000,%00001000,%00001000,%00001000,%00001000 '1
Data %00011100,%00010000,%00011100,%00000100,%00011100 '2
Data %00011100,%00010000,%00011100,%00010000,%00011100 '3
Data %00010100,%00010100,%00011100,%00010000,%00010000 '4
Data %00011100,%00000100,%00011100,%00010000,%00011100 '5
Data %00000100,%00000100,%00011100,%00010100,%00011100 '6
Data %00011100,%00010000,%00010000,%00010000,%00010000 '7
Data %00011100,%00010100,%00011100,%00010100,%00011100 '8
Data %00011100,%00010100,%00011100,%00010000,%00010000 '9
CIRCUIT DESCRIPTION
The circuit is very simple.The main component
is the PIC 16F84A (or PIC16F628).Remember the pull up resistor
on MCLR pin.The PIC is connected to the 2 MAX7221 with only
3 pins:
RB0 ---> DATA IN
RB1 ---> CS
RB2 ---> CLOCK
The bits in DATA IN pin are shifted to the second
MAX7221 via DATA OUT pin.
CS and CLOCK are both connected to the 2 7221.Download
MAX7221 datasheet for a detailed description of the device.
DS1307 is a real time clock,with I2C interface,produced
by Dallas Semiconductors.
DS1621 is a temperature sensor with I2C bus,produced
by Dallas too.
Please add 2 pull-up resistors (4K7 Ohms) on
scl and sda lines.
The switches are pulled up with 2 10Kohm resistors
and they are connected to PORTA.0 and PORTA.1
SOFTWARE
I starded to write my programs from Larry Gaminde's
7119 program. I have ported his code to 7221 and then I have
added many new lines.In order to check if wirings are correct,set
test control to 1 in the code(see setup sub in the code).In
this way the max 7221 will light on all the leds.You can change
also the bright control with the bright setting (from 0 to
9).
Test program
This program shows number form 1 to 99 on both
displays.
PIC16F84A
PIC16F628
Sorry for the bad quality of the pictures but
my webcam has not an high quality CCD sensor.
By the way,the effect of leds display is very
good by live.



Counter
Press S1 to increment the counter. Press both
S1 and S2 to reset.
Download Counter Program
(2 versions included:F84A and F628)

Digital Clock
In the F84A version,it is not possible to set
up the time with the buttons (not enough memory).In the F628
version you can change hours and minutes .
Press S1 while second digits are changing to
enter setup clock
' Press S2 to increment hours,press S1 to go directly to the
minutes routine
' While in minutes setting loo, press S1 to store the time
into real time clock
Download programs
 
Setting clock (16F628 version)
Press SW1 during seconds loop.

Press SW2 to inc hours. Press SW1 to store hour.
Press SW2 to inc minutes. Press SW1 to store
minutes and start clock.
|