To detect the state of a button, the I/O line to that
button is brought low, while all remaining I/O lines in the
LED matrix are left in the high-impedance input state.
For example, to read S1, CP01 (which is connected to
S1 via D1) would be set to low output. If the button is not
pressed, 2.5V from the voltage divider would be fed
through R8 into CP04. The LED, DM03 which is
CP04, will cause the voltage divider output to drop to the
operating voltage of that LED — between 2.0V and 2.4V.
This voltage appears at the microcontroller at RA2 via
R4. The current going through DM03 is greatly limited by
R6 and R8, and since the button is read in a few
microseconds, not enough current will flow through the
LED to make it appear to illuminate to the human eye.
If S1 is pressed, current through D1 will force the
output of the voltage divider to drop
to 0.7 volts. That voltage is passed
through R8 and R4 and appears on
RA2. So, to determine if a button is
being pressed, the microcontroller
brings that button’s I/O line low and
then looks at the resulting voltage on
RA2.
If it’s around 0.7 volts, then the
button is being pressed; if it’s two or
more volts, then it is not. Each button
is read one at a time by bringing that
button’s line low while leaving the
other Charlieplexed lines in their
high-impedance state.
The microcontroller has a built-in
comparator and a built-in
programmable voltage reference that
can be used to detect the small
voltage change. I programmed the
microcontroller so that RA2 is
connected to the inverting (-) input of
the comparator, and the noninverting
(+) input is connected to the
programmable voltage reference. I
set the voltage reference to 1.042V.
If the button is pressed, the
voltage at the I/O pin is 0.7V and the
comparator’s output goes high. If the
button is not pressed, the input
voltage is at least 2.0V and the
comparator’s output goes low. The
output of the comparator is read as a
1 or 0 by the microcontroller.
Time’s Up
That wraps it up for this month.
In Part 2, we’ll finish the circuit, make
the printed circuit board, build the
clock, and take a look at how the
software works. In the meantime, you
can find the software source files
with the article downloads if you
want to take a peek. See you next
time! NV
30 March 2018
® Sprite
Triggered HD 1080p Video Repeater
Noblack
when
looping!
Serialport
3vor5v
levels
Noblack when triggered!
Multiple trigger options
Multiple
baudrates
Simple serial control
Team Kingsley LLC sales@TeamKingsley.com Download Manual www.Medea Wiz.com
Like the Sprite at facebook.com/Medea Wiz for a chance to win one!
MedeaWiz 79
Phone: (618) 797-9951
79
Special price! Special price!
We ship world-wide
Purchase
Simple 1 byte serial control - Arduino, Pi, Picaxe, Propeller, Stamp, PLC
Video / Audio looping with a direct pushbutton / PIR trigger input
Serial port control of up to 200 ;les - With status feedback
PCB files and a kit is available in the Nuts & Volts
webstore at https://store.nutsvolts.com.