PICBASIC PRO from
I2CWrite and I2CRead
commands to handle the
The data that the DS1307
uses is in BCD format
which is converted in the
program to decimal.
Please see the
datasheet for more
information and guidance
on the crystal layout on
your particular board.
This is the CPU of the project. It requires a HEX file to
be flashed into the program memory (see Figure 10).
This microcontroller was selected for the number of
I/O pins it has; almost all are used. It has 8K of Flash
memory so it can run fairly big programs. You’ll have
plenty of room to add some graphic displays.
Applying 5V to the input side (pins 1-7) virtually
grounds the output side pins ( 10-16). When 0V is applied
to the input side, the output side goes to high impedance.
There is, however, a small voltage drop between the
output and ground. See the datasheet for more
These are transistor arrays that can switch higher
current since the microcontroller can only sink/source 25
mA max per I/O pin. The transistor arrays can switch up to
500 mA, so it’s perfect for switching the LED columns on
and off. It can be directly driven from the microcontroller
with 5V (see Figure 11).
This clock keeps the display lit by scanning each of
the column’s N1 to N12 for 500 µs. To keep the scanning
consistent, I’m using a timer interrupt. This utilizes a timer
(TMR0) which counts up one every four clock cycles. So
for a 20 MHz clock, this will increment every 200 ns; the
timer will count to 255 before resetting to zero. Upon
August 2011 31