PDA

View Full Version : 7 Segment Display Multiplexing



MR
02-26-2010, 12:26 PM
I have 10, 7 segment displays (Common Anode) wired in Parallel i.e. all the "A's" wired together, "B's" wired together etc., connected to a 7447 BCD Decoder.

Where do I connect the Anodes of each display?

What Command(s) do I use change the refresh rate of the display? "How to change the frequency from say 30hz to 100 hz"

I would be much obliged if someone would write some sample code with comments to learn from.

Basic Stamp 2P-40 Pins:

0=7447 A pin
1=7447 B pin
2=7447 C pin
3=7447 D pin

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
They say if you Play a Microsoft CD backwards you can hear satanic messages, that's nothing because if you play it forward it installs Windows!

I didn't Fail 10,000 times, I simply found 10,000 ways that didn't work. -Thomas Edison

Mike Green
02-26-2010, 01:21 PM
Download the StampWorks Manual from Parallax and look at Experiments #8-10 and #31 on LED multiplexing:

www.parallax.com/StoreSearchResults/tabid/768/txtSearch/stampworks/List/0/SortField/4/ProductID/144/Default.aspx (http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/stampworks/List/0/SortField/4/ProductID/144/Default.aspx)

You'll need to limit the total anode current for each display to under 20mA if you want to drive each of the displays from a Stamp I/O pin or you'll need to use a PNP switching transistor between each anode lead (collector) and Vdd (emitter) with the base lead connected to one of 10 Stamp I/O pins through a 1K resistor. You'll need current limiting resistors between each of the common segment leads and the 7447 outputs.

If you want to save I/O pins, you could use a 74HC42 BCD decoder to drive the PNP transistors and you'd only need 4 I/O pins to control the 10 displays.

MR
02-27-2010, 08:25 PM
Thanks Mike. Can you provide some code to help get me started? Specifically what I am looking for in the code is how to control the frequency/refresh rate in Hertz (Hz). I have been able to multiplex two digits so far but I have no control over the refresh rate in hertz. This is one way to do it, I was wondering if there were any other commands I could use. I need to know before ordering a circuit board. Thanks Mike!

Example Code:

Do
High 0 'Turn on Digit 1
digOne=%0001 'Digit 1 is 1
pause 10
low 0 ' Turn off Digit 1
clrDig=%1111 ' Clear the digit
high 1 'Turn on Digit 2
digTwo=%0100 'Digit two is 4.
clrDig=%1111 'Blank the display
loop

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
They say if you Play a Microsoft CD backwards you can hear satanic messages, that's nothing because if you play it forward it installs Windows!

I didn't Fail 10,000 times, I simply found 10,000 ways that didn't work. -Thomas Edison

Mike Green
02-27-2010, 09:21 PM
Look at www.emesystems.com (http://www.emesystems.com) using the "app-notes" link at the bottom of the page for a discussion of (among many topics) execution speed of Stamp statements. The PAUSE statements you insert is the main determinant of the refresh rate. Execution speed is roughly 12K instructions/sec. For each digit, you've got a HIGH, a LOW, and two simple assignments which classify as simple statements, so that's 12K/4 or 3K digits/sec. exclusive of the PAUSEs.

If you need to adjust the refresh rate, the PAUSE time can be an expression or variable. You can adjust that.