Skooks Pong - EEWeb
Skooks Pong - EEWeb
Skooks Pong - EEWeb
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>EEWeb</strong> PULSE TECH ARTICLE<br />
DESIGN<br />
I designed the binary clock based on the graphic below:<br />
The above graphic shows how a binary clock should<br />
be positioned to function correctly. I used six LEDs<br />
to represent the hours of the clock. Seven LEDs will<br />
represent the minutes of the clock. Finally, I used seven<br />
more LEDs to represent the seconds of the clock.<br />
With a total of twenty LED’s to represent a full 24 hour<br />
clock, however, this isn’t the only way this particular<br />
binary clock can be setup. I initially thought that the<br />
LEDs cycled from the top eight to the left bottom one,<br />
in a sort of carry effect, but each row stands for its own<br />
number of time, as in a single row cannot exceed 15<br />
from binary converted to decimal. In relation to the<br />
binary clock, a single row cannot exceed 9.<br />
There are limitations that come with the BSHWB. There<br />
are only 16 I/O pins available for use. There are 20 LEDs<br />
that are needed for a full clock as shown above. For<br />
this specific design, I wanted to limit the parts that are<br />
used, in order to reduce clutter, and cost. Unfortunately,<br />
functionality is also decreased with fewer parts.<br />
The above clock could be created using only 16 pins, but<br />
a couple different integrated circuits (ICs) would have<br />
to be used. The simplest way would be to use 14 pins for<br />
the minutes and seconds sections of the clock. The rest<br />
would have to be interfaced through at minimum four,<br />
four-output demultiplexers. These IC’s require three<br />
inputs and only give you one extra output. Obviously,<br />
I didn’t want to clutter the limited breadboard space I<br />
had with 4 ICs. So, for this project, the I eliminated the<br />
seconds, as shown below.<br />
Now only 13 I/O pins were used, under the assumption<br />
that most clocks do not have the seconds displayed.<br />
Most binary clocks do include the seconds section, but<br />
with these seven LEDs removed, three extra I/O pins<br />
were now available for added components.<br />
In order to make this design a little more original, I wanted<br />
to add the functionality of switching the clock over to a<br />
12 hour mode. Usually, binary clocks feature only a 24<br />
hour display mode. To do this, I needed a pushbutton<br />
switch, as well as an extra LED. The pushbutton would<br />
allow the user to switch between 12 hour mode and 24<br />
hour mode. The extra LED would notify the user when<br />
the clock is in A.M. (off) mode and P.M. (on) mode. The<br />
list of parts are detailed below:<br />
• BASIC Stamp HomeWork Board<br />
• 9V Battery<br />
• 14 LEDs (7 Yellow, 6 Green, 1 Red)<br />
• 14 – 470 Ω resistors<br />
• 1 – 220 Ω resistor<br />
• 1 – 10 kΩ resistor<br />
• 1 – pushbutton<br />
• At least 1 extra breadboard<br />
• Sufficient amount of wires<br />
For this project I decided to use 470 Ω resistors between<br />
the I/O pins and the LEDs. This is not the only way to set<br />
this project up, but I felt that 470 Ω is the right amount<br />
to get the desired brightness out of each LED. Another<br />
commonly used resistor that would work just as well is<br />
the 1 kΩ resistor, but with the 1 kΩ resistor the LEDs<br />
would be slightly more dim.<br />
PROGRAM FLOW<br />
Fortunately, with the use of the BSHWB, coding for<br />
circuits is simple. The BASIC Stamp Editor codes in<br />
PBASIC, which is a simple and educational coding<br />
language. It allows for the declaration of variables and<br />
includes IF-ELSE statements and FOR Loops.<br />
I coded this project as simply as possible. I tried to limit<br />
variables and only used the HIGH/LOW command to<br />
turn the LED’s on and off. There are more efficient ways<br />
to structure and design this code, but because I was<br />
working on a budget, I tried to make the design of the<br />
code similar to the design of the circuit.<br />
Using one continuous loop simulating a non-stop 24hour<br />
cycle, a combination of IF-ELSE statements, and<br />
one FOR Loop is used. The FOR Loop’s arguments<br />
only apply to the variable used by the first row of the<br />
minutes section, but all of the IF checks for the correct<br />
time are made in both the infinite loop and the FOR<br />
Loop. Nothing special went into efficiently keeping<br />
track of the illuminated LEDs. I used four counters<br />
for each row of LEDs. Each counter had a series of IF<br />
statements associated with it in order to make sure the<br />
correct LEDs were illuminated. The counters updated<br />
at the end of each series of IF statements. Each LED<br />
was then commanded to go High or Low depending on<br />
what period of time it represented.<br />
I set up my program to start from time zero every time.<br />
This is not the way a clock should be setup. You are<br />
rarely going to be starting this clock at midnight every<br />
time you replace the battery. If you would like to add<br />
functionality to this binary clock, increase the number<br />
of available pins with a few demultiplexers and use<br />
a potentiometer and an extra pushbutton to help with<br />
setting the time.<br />
FINAL DESIGN<br />
Although there are some limitations with the BSHWB,<br />
the potential for a full scale binary clock is available.<br />
Actually there are ways to develop a binary clock<br />
only using Flip-Flops and Gates. There are also other<br />
microcontroller based circuit boards with more I/O pins<br />
that can make development much easier. My particular<br />
setup is shown below:<br />
24 <strong>EEWeb</strong> | Electrical Engineering Community<br />
Visit www.eeweb.com<br />
25