Maker Pro
Maker Pro

multiplex 7seg LED with drivers

Hello folks,

I'm in the process of designing a toy circuit to keep track of life
counters for various games. It should support 3 players. Each player
will have two 7 segment LED displays that will display a number between
0-99, and also 2 switch buttons that will be used to increase and
decrease the number displayed on these LED displays.

I have a handful of 16f84 PIC's and currently learning how to program
them. With only a limited number of input/output pins on this chip
(13 I believe) what would be a good way to allocate these pins for the
switch buttons and displays?

I have read various articles in the Usenet archives which suggest
multiplexing displays, this requires 7 pins for each segment and 1
pin for every other display. I think this will eat up in to all my
pins though. Can I use the same multiplexing technique with a single
display/driver chip? Any suggestions? Also any thoughts on the switches?

This is my first electronics project and PIC programming project
(ambitious, yes)

Thanks
 
C

CFoley1064

Jan 1, 1970
0
From: [email protected]
Date: 2/9/2004 3:56 AM Central Standard Time
Message-id: <[email protected]>

Hello folks,

I'm in the process of designing a toy circuit to keep track of life
counters for various games. It should support 3 players. Each player
will have two 7 segment LED displays that will display a number between
0-99, and also 2 switch buttons that will be used to increase and
decrease the number displayed on these LED displays.

I have a handful of 16f84 PIC's and currently learning how to program
them. With only a limited number of input/output pins on this chip
(13 I believe) what would be a good way to allocate these pins for the
switch buttons and displays?

I have read various articles in the Usenet archives which suggest
multiplexing displays, this requires 7 pins for each segment and 1
pin for every other display. I think this will eat up in to all my
pins though. Can I use the same multiplexing technique with a single
display/driver chip? Any suggestions? Also any thoughts on the switches?

This is my first electronics project and PIC programming project
(ambitious, yes)

Thanks

You might want to look at getting a couple of the Maxim MAX6958AAPE. They're
16 pin DIP ICs, controlled by a 3-wire serial interface, and will each
automatically take care of driving four 7-segment LED displays. If you're
really I/O challenged, try the MAX6959, which includes capability to read up to
eight pusbuttons per IC. I didn't see either part at DigiKey, but theyre in
stock from Maxim-direct. They take credit cards.

Yes, it might be fun to do the interface in a more complicated way (74LS47
BCD-to-7-segment common anode display driver IC[4 PIC pins], 4017 counter to
74HC04 inverter to discrete transistors to drive common anodes[2], 6
pushbuttons[6] = 12 pins, or if you're desperate use a serial shift register to
shift in data from the pushbuttons to bring it down to 8 pins), but learning
how to program a serial interface is also a useful exercise.

http://www.maxim-ic.com/

Good luck
Chris
 
T

Thierry C. \(NOOS\)

Jan 1, 1970
0
Hello.
[...]
I have read various articles in the Usenet archives which suggest
multiplexing displays, this requires 7 pins for each segment and 1
pin for every other display. I think this will eat up in to all my
pins though.

You can reduce the "I/O pin per digit" count by using a
decoder/demultiplexer (74*138 or 74*238, depending on the display's
polarity) : a binary number on 3 PIC's output pins will activate only one of
the eight output pins of the demultiplexer, allowing you to drive up to
eight digits (don't forget to put a transistor between the demultiplexer and
each digit because the demultiplexer pins can't provide enough current to
light many LEDs at a time).
Can I use the same multiplexing technique with a single
display/driver chip?

I'm not sure to have understood this well : do you mean a "binary to
7-segment combination" decoder/driver IC ? Then it doesn't remove the above
possibility because such a single driver IC will drive the segment lines
that are common to all digits.
Any suggestions? Also any thoughts on the switches?

For this, you may be able to do it using only one PIC's extra pin by
multiplexing the switches :
each of the above demultiplexer's outputs used (or not) to drive a digit can
simultaneously be reused : between each demultiplexer output and a common
point, connect a switch in series with a diode, and then connect the common
point to a PIC's input pin and to a pullup resistor.

Another solution to multiplex the switches is to wire them on an explicit
separate demultiplexer IC (74*151 or 74*152) whose three selection inputs
can be wired on the three PIC's output pins used to select the digit
This is my first electronics project and PIC programming project
(ambitious, yes)

Thanks

You're welcomed.
 
R

R. Steve Walz

Jan 1, 1970
0
Hello folks,

I'm in the process of designing a toy circuit to keep track of life
counters for various games. It should support 3 players. Each player
will have two 7 segment LED displays that will display a number between
0-99, and also 2 switch buttons that will be used to increase and
decrease the number displayed on these LED displays.

I have a handful of 16f84 PIC's and currently learning how to program
them. With only a limited number of input/output pins on this chip
(13 I believe) what would be a good way to allocate these pins for the
switch buttons and displays?

I have read various articles in the Usenet archives which suggest
multiplexing displays, this requires 7 pins for each segment and 1
pin for every other display. I think this will eat up in to all my
pins though. Can I use the same multiplexing technique with a single
display/driver chip? Any suggestions? Also any thoughts on the switches?

This is my first electronics project and PIC programming project
(ambitious, yes)

Thanks
 
G

Guest

Jan 1, 1970
0
R. Steve Walz said:
You can diddle around with a PIC if you want, but this is waaay easy
without one. To engineers your question sounds like how to make a
poster for your next political demonstration using a sewing machine.
-Steve

Hello Steve,

Well I figured it would be easier for me to implement this using a PIC
since I've been programming for years now and understand those concepts
_but_ I'm new to electronics, so I dont know yet where I need to use
transistors, or what a pull up resistor is for, etc. (I am still learning)

I also figured with a PIC I can add nifty features later down the road by
simply reprogramming it. For example, one thing I have planned after
I finish this, is a chess clock type feature, so players don't take
FOREVER on their turns

Take care
-v
 
G

Guest

Jan 1, 1970
0
hamilton said:

Hi Hamilton,

Yep I've read through those, A log of nice application notes on microchips
website and have gotten some ideas, but they didn't use any multiplexing
with drivers/decoders which is what I had in mind and was wondering if
that was even possible.

Take care.
-v
 
R

R. Steve Walz

Jan 1, 1970
0
Hello Steve,

Well I figured it would be easier for me to implement this using a PIC
since I've been programming for years now and understand those concepts
_but_ I'm new to electronics, so I dont know yet where I need to use
transistors, or what a pull up resistor is for, etc. (I am still learning)

I also figured with a PIC I can add nifty features later down the road by
simply reprogramming it. For example, one thing I have planned after
I finish this, is a chess clock type feature, so players don't take
FOREVER on their turns

Take care
-v
 
B

Byron A Jeff

Jan 1, 1970
0
-Hello folks,
-
-I'm in the process of designing a toy circuit to keep track of life
-counters for various games. It should support 3 players. Each player
-will have two 7 segment LED displays that will display a number between
-0-99, and also 2 switch buttons that will be used to increase and
-decrease the number displayed on these LED displays.

OK.

-
-I have a handful of 16f84 PIC's and currently learning how to program
-them.

Good for PICS. 16F84 is not so good a choice. Use them if you have them for
this project. But they are several generations behind the current stuff. My
16F84 is obsolete page explains why:

http://www.finitesite.com/d3jsys/16F628.html

- With only a limited number of input/output pins on this chip
-(13 I believe) what would be a good way to allocate these pins for the
-switch buttons and displays?

It only takes 9 pins to multiplex the displays. That leaves more than enough
I/O available for the switches.

You didn't say if the displays were Common Anode or Common Cathode. But the
basic game plan is to wire an I/O pin to each of the 7 segments, then wire
the common end of each display to another pin via a current limiting resistor.

Now here's the problem you'll run into: PIC I/O pins don't source/sink enough
current for you do drive the entire display at one time. So in addition
to multiplexing the displays, you also multiplex the segments, making sure
that you only turn on one segment at a time in your software. Since you're
only going to turn on 1 segment, you can put as much as 20 mA of current
through it, which should make it bright enough for the job.

I like this method because then the display only requires a single resistor
as opposed to 7 resistors, one for each segment.

-
-I have read various articles in the Usenet archives which suggest
-multiplexing displays, this requires 7 pins for each segment and 1
-pin for every other display.

Every display. Not every other one unless you plan to add an external
inverter.

- I think this will eat up in to all my pins though.

OH! You mean that a single 16F84 has to drive 6 displays and 6 switches?!?!

I see. You're going to need some external hardware then. I'm partial to
7445 BCD to decimal decoders in such situations. Also you can go serial to
parallel and use a 74HC595 serial to parallel chip.

The right answer of course is to simply use a bigger PIC with enough I/O to
do the job. Or since you say you have several 16F84, why not assign 1 for
each player?

- Can I use the same multiplexing technique with a single
-display/driver chip? Any suggestions? Also any thoughts on the switches?


-
-This is my first electronics project and PIC programming project
-(ambitious, yes)

Not too bad. Be sure to take a look at my Languages page too, which is
linked off the page above. JAL may be helpful here, especially since it
has 7 segment routines in it.

BAJ
 
T

Thierry C. \(NOOS\)

Jan 1, 1970
0
[...]
Hello Steve,

Well I figured it would be easier for me to implement this using a PIC
since I've been programming for years now and understand those concepts
_but_ I'm new to electronics, so I dont know yet where I need to use
transistors, or what a pull up resistor is for, etc. (I am still learning)

Don't get discouraged ; you'll learn it progressively, through websites
teaching electronics, or articles in electronics magazines where you get
explanations about the technical solutions used for the designs.
I also figured with a PIC I can add nifty features later down the road by
simply reprogramming it.

Yes, but the need to use as few I/Os as possible requires us to focus on the
electronic design considerations to solve the problems that the software
can't solve alone. Here is the way to think about it :

For our multiplexed display, let's consider first that we'll drive the
segments of all digits with 7 PIC's output pins (for one digit at a time,
we'll turn on any combination of segments to display digits or anything else
by using the appropriate logic level depending on the display's polarity).
We have six digits to activate one at a time through their common pin. But
on six PIC's outputs we'll output only six combinations (one output is
active and the others are not) among the 64 that are possible, then we see
we're wasting something... Now, if we output the activated digit's index (0
to 5 for the consecutive six digits) as a binary number, it will fit into
three bits = output lines (instead of six). At last, we need to translate
that binary number to "only the corresponding output activated at a time" :
that's the job of a decoder/demultiplexer IC, a common combinatorial logic
device type. For example, the 74*138 (the active output is low) or 74*238
(the active output is high).

Then, the need of a transistor on each digit is due to the amount of current
needed when all segments are lit on one digit (7 x 20mA if we guess 20mA per
segment), that is much higher than what can be provided by the IC outputs
activating each digit one at a time. You'll find many examples in magazines
or on the Web or in books.

(and for the buttons set there is another electric trick to share / reuse
the above outputs for them without disturbing the whole display

"For this, you may be able to do it using only one PIC's extra pin by
multiplexing the switches :
each of the above demultiplexer's outputs used (or not) to drive a digit can
simultaneously be reused : between each demultiplexer output and a common
point, connect a switch in series with a diode, and then connect the common
point to a PIC's input pin and to a pullup resistor (it your transistor are
PNPs on the high side, otherwise a pulldown if they're NPNs wired on the
ground)."
).
For example, one thing I have planned after
I finish this, is a chess clock type feature, so players don't take
FOREVER on their turns

The high level function is only related to software indeed. Unlike the
low-level one (displaying six characters and responding to six buttons) that
is a matter of both software and hardware.

Hope it has helped you.
 
C

CBarn24050

Jan 1, 1970
0
Hi, I have had to do this for a recent product, here's how I did it. Connect 7
port pins to a uln2003 array and a ls373 latch, connect the last port pin to
the latch ale. Connect another uln2003 to the output of the latch with some
pull ups, the output of this driver goes to the cathods of the led array.The
anodes are suplied via a pnp transistor connected to the unregulated side of
the power supply, the base is onnected, with series resistor to the output of
the first uln2003. Push buttons are connected the same way as has been
mentioned in previous posts. If you post your email address I'll send you a
schematic.
 
Top