FIGURE 3. My DIY HP- 45 calculator using two
MAX7219 ICs to make this colorful 10-digit numeric LED
display by just wire-wrapping each LED segment to the
MAX7219 driver.
all the necessary source code files on the SERVO website at
www.servomagazine.com. In Listing 1, I show you how
to send the necessary configuration commands to the
MAX7219 using the information provided in Table 1 and
how to display the value of PI. There is also a second
example showing you how to use the driver routines to
display integer values ranging from 0 to 99999 in Listing 2.
This example calls routine itoa to first convert the integer
value to an ASCI string and then calls LED_Print to send
each digit to the MAX7219 LED driver so that it can be
displayed.
The code was developed using Microchip MPLAB and
the PIC18 C compiler; it also uses the WPILIB library. The
code configures the controller’s digital ports to outputs and
sets each LED segment to the desired state by issuing the
appropriate MAX7219 command. In the code, you see an
infinite while loop that converts the integer value to ASCII
and sends each digit to the MAX7219 so that it can display
the appropriate value from 0 to 99999. It then waits for a
few milliseconds before displaying the next digit.
In the source code, I included functions to initialize the
MAX7219 LED controller and to send the characters 0 to 9;
“.”; and “H,” “E,” “L,” “P” using the LED_Print function. To
include support for your own applications, just add
ROBOTC is another C-language programming environment
specifically targeted for the VEX products. It is developed by the
Robotics Academy at Carnegie-Mellon University. It includes
features like interactive single step debugging with variable
watching and real-time monitoring of sensor values and motor
settings. A 30-day evaluation version is available from
www.robotc.net. It does require the orange colored
programming cable that comes with the VEX Programming
Hardware Kit.
70 SERVO 05.2010
(Test) Tool Time
Here are some ideas for test equipment to help you
with troubleshooting.
FIGURE A.
Voltmeter – A basic diagnostic tool for debugging
circuits is a digital voltmeter (DVM). The DVM shown in
Figure A can be used to measure quantities such as voltage,
current, resistance, capacitance, inductance, and continuity
at various test points in your circuits. The continuity tester
beeps if there is a good electrical connection between any
two points. Use a schematic as a guide and test all the
connections systematically.
Logic probe – A low cost digital probe indicates a
digital I/O pin is high or low, or pulsing using a simple LED
display. Logic probes typically support both TTL and CMOS
digital outputs.
Oscilloscope – This is a very useful electronic diagnostic
and test tool, although some models can be very expensive.
It provides a beam trace of one or more analog signals on a
CRT or LCD display at various frequencies ranging from 20
MHz to 1 GHz. Oscilloscopes can be used to measure
voltage, frequency, amplitude, period, current, and many
other signal properties. Dual trace oscilloscopes can be
found for around $70 to $200.
Logic Analyzer – This digital diagnostic tool displays
the state of digital signals, busses, etc. They can easily
display eight, 16, 32, or 64 traces at one time to show the
timing relationships between signals. They store the data in
a very large buffer so that the signals can be captured and
played back later for analysis.
Virtual Instruments – This is PC or laptop based
software that simulates oscilloscopes, logic analyzers, and
digital voltmeters. This is one way to keep costs down, but
still get the data you need.
Why Use a MAX7219 LED Display Driver?
Numeric LED displays can be driven directly from the
VEX controller using discrete components instead of the
MAX7219 IC. However, but to do this requires complicated
firmware to pulse each LED at the selected refresh rate
using timers and Interrupt Service Routines (ISRs), in
addition to using most of the controller’s I/O pins unless a
decoder IC is also used. That’s why I chose the MAX7219.