7-Segment LED Display Driver Using The C Stamp: A Passion For Execution
7-Segment LED Display Driver Using The C Stamp: A Passion For Execution
7-Segment LED Display Driver Using The C Stamp: A Passion For Execution
Volume
Notices 4
Getting Support 4
Segments Displays 4
Projects 7
Introduction
T
here are serially interfaced 7-Segment LED display drivers that interface
microcontrollers to 7-segment numeric LED displays. This software uses a
method called “Charlieplexing” developed by Charles Allen at the Maxim
Corporation. The implementation of Charlieplexing calls for the driving of
LED digits using the smallest number of I/O pins on the microcontroller as possible.
Additionally, the LED's must be turned on and off at a rate at which a human cannot
notice any flicker, usually anywhere from 30-50Hz. Charlieplexing allows for N I/O
pins to control N*(N-1) LED's. At any particular time, only one of the LED segments
is turned on. Immediately after the segment is lit, the segment is turned off and the
next segment in the implementation is turned on. The following figure is an example
of the implementation of Charlieplexing.
Getting Started
In this specific example, we show the design of a 2 Digit display driver using the
Charlieplexing scheme. Using the formula N*(N-1), it was determined that
1
A - W I T T E C H N O L O G I E S I N C .
mathematically, only 5 I/O pins were necessary to drive 2 LED's (16 total segments).
However, a simple problem within the design prevented this from being properly
implemented. It was discovered that when using only 5 I/O pins, the common anode
must be switched during the process of lighting the LED. When the common anode is
set to HIGH with another pin set to LOW, it results in two pins being connected to
the LED, causing 2 segments to light up simultaneously, as opposed to one segment. It
was then determined that at least 8 I/O pins were necessary to drive any number of
seven segment LED's properly. Therefore using 5 I/O pins to drive 2 digits cannot be
done.
The goal of this design was to implement the Charlieplexing scheme to drive 2 LED
displays. Common anode LED displays were used in this implementation. All resistors
in this design were 100 Ohms, which allowed for a peak current of 50mA with our 5V
supply. The calculated refresh rate was 50Hz per segment to avoid any flicker. The
figures below show the Charlieplexing schematic used as well as a picture of the
implementation.
Below, one can see the LED display while the software is in operation.
2
A - W I T T E C H N O L O G I E S I N C .
The C Stamp design was able to blank the display on power up, and allowed for
individual LED segment control. Individual LED's were also successfully addressed
and updated without rewriting the entire display. Finally, a master/slave scheme was
also successfully implemented, giving the user full LED segment control, using the RS-
232 telecommunication protocol.
3
A - W I T T E C H N O L O G I E S I N C .
Notices
CSTAMP™ and CSTAMP™ Related Hardware Products, Software
Products and Documentation are developed and distributed by A-WIT
Technologies, Inc. All rights reserved by A-WIT Technologies, Inc. A-WIT
SOFTWARE OR FIRMWARE AND LITERATURE IS PROVIDED
“AS IS,” WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL A-WIT BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER LIABILITY ARISING OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR FIRMWARE OR THE USE OF
OTHER DEALINGS IN THE SOFTWARE OR FIRMWARE.
Getting Support
If possible, please check the C Stamp website www.c-stamp.com under SUPPORT for
any updates to documentation, changes, or notices that may have become available
since your Installation CD was produced. If you continue to have any issues for which
a solution is not found in the aforementioned website, please e-mail tech_support@a-
wit.com for help.
// Prototypes
void setupLED(BYTE sevseg, BYTE ledseg);
4
A - W I T T E C H N O L O G I E S I N C .
void main(void){
// Initializing VALUES to be used
NIBBLE result;
RAM BYTE buffer[255];
BYTE hello[] = "Enter 2 numbers:\n\r";
BYTE data[2];
BYTE i;
BYTE j;
5
A - W I T T E C H N O L O G I E S I N C .
GTPIND(SEVSEGS_LDS[j][i]);
}
for(i=0; i<2; i=i+1)
GTPIND(SEVSEGS_CAS[i]);
while(TRUE)
writeLEDs(data);
}
GTPIND(SEVSEGS_LDS[sevseg][ledseg]);
GTPIND(SEVSEGS_CAS[sevseg]);
}
6
A - W I T T E C H N O L O G I E S I N C .
}
}
}
7
A - W I T T E C H N O L O G I E S I N C .
A-WIT has stringent quality control procedures in place to insure the best quality
products.
A-WIT Technologies, Inc warrants its products against defects in materials and
workmanship for a period of 90 days. If you discover a defect, A-WIT Technologies,
Inc. will, at its option, repair, replace, or refund the purchase price. After 90 days,
products can still be sent in for repair or replacement, but there will be a $10.00USD
minimum inspection/labor/repair fee (not including return shipping and handling
charges).
If, within 14 days of having received your product, you find that it does not suit your
needs, you may return it for a refund. A-WIT will refund the purchase price of the
product in the form of a check, excluding shipping/handling costs, once the product is
received. This refund does not apply if the product has been altered or damaged. If you
decide to return the products after the 14-day evaluation period, a 20% restocking fee
will be charged against a credit.
Disclaimer
Warranty does not apply if the product has been altered, modified, or damaged. A-
WIT makes no other warranty of any kind, expressed or implied, including any
warranty of merchantability, fitness of the product for any particular purpose even if
that purpose is known to A-WIT, or any warranty relating to patents, trademarks,
copyrights or other intellectual property. A-WIT shall not be liable for any injury, loss,
damage, or loss of profits resulting from the handling or use of the product shipped.
When returning, you must first e-mail [email protected] for a Return Merchandise
Authorization number. No packages will be accepted without the RMA number clearly
marked on the outside of the package. After inspecting and testing, we will return your
product, or its replacement using the same shipping method used to ship the product
to A-WIT within 30 days. In your package, please include a daytime telephone number
and a brief explanation of the problem.
Please contact our Sales Department at [email protected] if you have any questions
regarding our warranty policy or if you are requesting an RMA number.
8
A - W I T T E C H N O L O G I E S I N C .