www.jrhackett.net
M2-class processors. We
don't need to declare time in
our program; in fact, trying to
do so will produce an error.
When a program first starts
running, time is automatically
initialized to 0, and it
automatically increments
once per second. In the
present program, the if/then
statement simply restricts the
value of time so that it's
always between 0 and 99.
2) Our two transistor switches
always toggle between one
display digit and the other.
Therefore, the A.0 pin doesn't
provide a way of turning off
both display digits at the
same time. In effect, setting
pinsB equal to 0
accomplishes this for us,
because a value of 0 results
in none of the segments
being lit. Once we have
"turned off" the display, we
can move on to the next
instruction without producing
any ghosting.
3) Placing A.0 in a low state
activates the one's digit on
the display, but pinsB is still 0,
so nothing shows up yet.
Before reading further, you
may want to experiment with
ghosting at this point. If so,
edit the program by removing
or "commenting out" the
pinsB = 0 statement, and
download the program again.
In the one's digit of the
display, you will see what
ghosting looks like.
At this point, you may have
concluded that the timing
requirements of a multiplexed
display are somewhat demanding. If
so, you would be absolutely correct!
When I first began experimenting
with the N514RA, I thought that the
speed requirement would be the
biggest problem.
However, that doesn't seem to
be the case. I measured the
frequency of the main do/loop in
the
LEDmultiCount99.bas program
at 120 Hz, so even if we were to
add a fair number of programming
tasks to the do/loop, it would still
probably run fast enough to avoid
flickering.
However, the "balancing"
requirements are another story. Any
time we add additional code in the
part of the loop that updates the
one's digit of the display, we also
need to add code in the part of the
loop that updates the ten's digit of
the display.
If we didn't do that, one digit of
the display would appear to be
brighter than the other. Of course,
we could adjust the pause
statement to compensate for that,
but it would require a constant
56
February 2013