Tables.” The upper nibble contains the line number that is
to be driven high and the lower nibble contains the line
that is to be driven low. Each nibble is in the range of
1.. 14 decimal. The nibbles are then looked up using the
tables under the heading “Charlieplex Port Masks” to
calculate and set the Port and Tris values.
To set the Port and Tris values, the main routine calls
timeLEDout or alrmLEDout (in led.inc) as appropriate. For
each LED to be lit, these routines perform the lookups
outlined above and calculate the Port and Tris values for
both Port A and Port B. The Port and Tris values are not
sent to the actual Port and Tris registers but are stored in
shadow registers. The interrupt routine copies the shadow
registers to the actual Port and Tris registers at the
appropriate time for each LED.
Two additional files — definitions.inc and registers.inc —
contain definitions for constants, file registers, bit
assignments, time calculations, and port definitions. I’ve
34 May/June 2018
Resources
Digi-Key
www.digikey.com
Parts source for most of the
components.
Jameco Electronics
www.jameco.com
Additional parts source.
Microchip
www.microchip.com
Manufacturer of the microcontroller
used for the clock. Of particular
interest is their Charlieplexing
application note TP029
( www.microchip.com/wwwAppNote
s/ AppNotes.aspx?appnote=en01163
6) and their free MPLAB IDE
( www.microchip.com/mplab/mplab-x-ide).
DipTrace
www.diptrace.com
Schematic and printed circuit board
design software. Free version
support up to 300 pins and two
signal layers for non-profit use, or
500 pins and two signal layers for
academic use.
Bay Area Circuits
www.bayareacircuits.com
Manufactures printed circuit boards.
They had a student special that
allowed me to make the board for
my clock for only $30 at the time.
FNET/GridEye
fnetpublic.utk.edu
Real-time monitoring of electric grid
frequency from around the world.
Wikipedia — "Utility Frequency"
en.wikipedia.org/wiki/Utility_
frequency
This article has a lot of information
about the 50 or 60 Hz frequency
used by the utility companies. Of
particular interest is the section on
Stability.