Shop OBEX P1 Docs P2 Docs Learn Events
Multiplexing Help/Question — Parallax Forums

Multiplexing Help/Question

MRMR Posts: 46
edited 2007-11-17 19:55 in BASIC Stamp
Hi,

I currently multiplex 10 common anode 7 segment displays using a 7447 bcd to seven segment decoder and the basic stamp 40 pin version.

All the displays are on one board and are wired in parallel, All the A segments are wired together, B's, C's, D's, E's, F's, G's. And Connected to one 7447 decoder chip.

I don't use transistors, I only use the stamp pins to turn on and turn off the appropriate display and send the appropriate binary pattern for that display.

The problem:

I want to add 20 more 7 segment displays, Com. Anode, for a total of 30, 7 segment displays, and I only want to use 1 7447 chip to do it. IS THIS Possible? I think it is since only one display is really ever on, our persistence of vision tricks us into thinking they are all lit.

The Second problem:

I need a way to turn on and turn off each segment in sequence without sacrificing all the basic stamp pins to the anodes. AND, I need the displays to be bright enough.
I was thinking of using some kind of external chip, that the stamp can control serially with say 3 pins, and the ten anodes could connect to this external chip. Thus saving me 7 pins instead of ten.

Post Edited (MR) : 10/30/2007 7:46:01 AM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-10-30 14:40
    You can't do it this way. As you increase the number of displays, you have to increase the amount of current because what you see in the brightness of each display is the average current (approximately). The 7447 is designed to supply maybe 25ma per segment and the Stamp pins can supply about the same per display. Across 10 displays, that's about 2.4ma average current which is enough to see, but not brightly. If you want more brightness, you're going to have to use external transistors. You'll need one PNP switching transistor like the 2N3906 for each 7 segment display to switch the common anode connection and an NPN switching transistor like the 2N3904 to switch the 7 cathodes. The 7447 can't feed the 2N3904 directly because the transistor turns on when the base is connected (through a current limiting resistor) to Vdd and the 7447 grounds active output pins. You'll need either a logic inverter or just some PNP transistors there to function as an inverter.

    Other considerations:
    To get a higher peak current, you have to use lower series resistors on the LED segments. If you leave one display on for any length of time, you'll burn it out, so you'll need to make sure that the 7447 is inhibited on power-on until the Stamp can properly initialize itself (maybe using the blanking input with a pulldown resistor on it).

    If the current brightness is adequate, you could use 3 - 7447 drivers, one for each group of 10. You could use 4 - 74HC595 serial output shift registers cascaded in series to drive the anodes using only 3 or 4 I/O pins. The 74HC595 can drive up to 35ma (but a total of only 70ma per device). This way you'd not need the transistors. To save I/O pins on the 7447's, you could even use two more 74HC595's to drive the 7447's.
  • MRMR Posts: 46
    edited 2007-10-30 15:45
    Mike said...
    If the current brightness is adequate, you could use 3 - 7447 drivers, one for each group of 10. You could use 4 - 74HC595 serial output shift registers cascaded in series to drive the anodes using only 3 or 4 I/O pins. The 74HC595 can drive up to 35ma (but a total of only 70ma per device). This way you'd not need the transistors. To save I/O pins on the 7447's, you could even use two more 74HC595's to drive the 7447's.

    I will use the 3 7447's and have a row of 10 displays.
    Mike said...
    You could use 4 - 74HC595 serial output shift registers cascaded in series to drive the anodes using only 3 or 4 I/O pins.
    THAT excellent it reduces the amount of pins I need to drive the anodes. My only question regarding this. What would the code look like to turn each display on in sequence if they are being driven through the shift registers? Perhaps shiftout pin number, certain number of bits, and a clock pulse, as each bit is shifted it would turn on each display in sequence. Am I correct? Just trying to get an idea.


    Mike said...
    To save I/O pins on the 7447's, you could even use two more 74HC595's to drive the 7447's.
    I am not sure what you mean here.


    I know what maximum current rating is on microchips, please explain to me how you figured out 30 displays would be too much current. I don't understand how to figure current in a project, I always have to rely on prototyping, if I can learn to figure the current first it will save me a great deal of time not to mention money because I will know how to figure out total current and determine weather it will exceed the maximum current rating.
    Mike said...
    The 7447 is designed to supply maybe 25ma per segment and the Stamp pins can supply about the same per display. Across 10 displays, that's about 2.4ma average current which is enough to see, but not brightly.

    The above quote is a good example of what I am asking, how did you figure the current across the ten displays?

    Thank You,

    Regards,

    MR
  • Mike GreenMike Green Posts: 23,101
    edited 2007-10-30 16:26
    The StampWorks Manual (downloadable here: www.parallax.com/detail.asp?product_id=27220) has a chapter on serial output shift registers (#23). The idea is that you would always have 3 one bits in the shift register and the rest zero bits (for the 3 displays that are on at any one time). Each time you change the 7447 data, you'd toggle the shift clock, then toggle the load clock to advance the 3 bits through the shift register. Once every 10 clocks, you'd have to set the data line to high (then low on the next clock cycle) to introduce a new one bit into the register.

    The idea of using another pair of 74HC595's is that you'd need at least 4 I/O pins for each of the 3 - 7447's. If you're tight on I/O pins, you could use a pair of 74HC595's cascaded to form a 16 bit register that would be connected to the 3 - 7447's. You'd use a SHIFTOUT statement (as shown in the StampWorks Manual) to transfer the necessary 16 bit value to the 74HC595's, then toggle the load signal to update the output pins on the 74HC595's.

    Regarding the "off the cuff" supply current estimates ...
    You've currently got 10 displays. Each 7447 output can handle approximately 25mA and I assume that all segments can be driven at the same time since the datasheet doesn't say otherwise and that's how the part would be used. If you drive each display for 10% of the time, that's an average of 2.5mA per display segment per display. The problem is that you're actually providing 25mA per segment and, if you're displaying all 8s, that's 7 x 25 = 175ma. The Stamp pins that are driving the common anodes can't handle this kind of current since they're rated only for maybe 40mA max. and the whole chip is limited to maybe 180mA depending on the chip temperature.

    As I go over this, it's obvious that you'll need PNP transistors for the common anodes anyway since the total current can be much more than either the Stamp or the 74HC595's can handle.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-11-01 15:04
    MR,

    Have you considered the MAX7219? I have used this IC in several projects. One chip drives eight 7-segment displays. This IC drives CC displays but I believe there is a version for CA displays. You can see an example of it at the following link. Take care.

    http://forums.parallax.com/showthread.php?p=552892

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • MRMR Posts: 46
    edited 2007-11-03 13:09
    Whenever I hook up the transistor

    PNP 2n3906

    to the common anode displays, the amperage is increased but the display goes to an 8
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-03 14:55
    How have you hooked it up? The emitter should go to Vdd, the collector to the LED anodes, the base through a current limiting resistor (330 to 470 ohms usually) to the I/O pin.

    The display should not go on unless the I/O pin is grounded (made LOW).

    If all segments are showing (as 8), then perhaps something funny is going on with the 7447. What signal is being provided to the 7447 when this happens?
  • MRMR Posts: 46
    edited 2007-11-03 15:18
    Oh, I see, I had the connections to the transistor backward, now the amperage is much brighter.

    Thanks for the help.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-03 15:38
    PNP transistors work "backwards" from the way NPN transistors work. You have to swap positive and negative.

    For what it's worth, when germanium transistors were the only thing around, they were all PNP. All transistor circuits used PNP transistors and the ground connection was always the positive battery terminal. Vdd was always negative. This was backwards to the way tubes worked and caused all sorts of confusion until people got used to it. Then they invented silicon transistors which initially came in NPN versions only and everything drifted back to the way it was with tubes. Now you've got both and you can think both ways at once.
  • MRMR Posts: 46
    edited 2007-11-03 15:45
    Mike Green said...
    PNP transistors work "backwards" from the way NPN transistors work. You have to swap positive and negative.

    For what it's worth, when germanium transistors were the only thing around, they were all PNP. All transistor circuits used PNP transistors and the ground connection was always the positive battery terminal. Vdd was always negative. This was backwards to the way tubes worked and caused all sorts of confusion until people got used to it. Then they invented silicon transistors which initially came in NPN versions only and everything drifted back to the way it was with tubes. Now you've got both and you can think both ways at once.

    Thank You for the Clarification, I was wondering why it wasn't working properly. Again, thank you for all your help Mike.


    Regards,

    MR
  • MRMR Posts: 46
    edited 2007-11-06 04:44
    Mike,

    Something isn't working. I have double checked and the wiring to the transistor is just as you said. All the other displays turn off and only one display lights up with a bright 8.

    I don't yet have the 74HC595's, they are still in the mail so I used three 74ls194 Universal shift registers, and I have it set serial shift right. I am attaching my code maybe that will help. When ever I just use the stamp pin to turn on and turn off each display it works fine its just the amperage is too low, and I have to pause 1, because any pause rate higher and I will see flicker and not a solid display. now when I use a higher rate say 500 I see each digit cycle on and off in sequence and the amperage is great, but when I change the refresh rate or the pause, the displays get dimmer.




    here is my code, I know its the greatest but thats how I learn by making mistakes.
  • MRMR Posts: 46
    edited 2007-11-06 06:59
    I found the problem in the code, instead of providing a high, I needed to provide a low for the transistor to switch.
  • D FaustD Faust Posts: 608
    edited 2007-11-06 13:24
    That is how PNP works.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --DFaust
  • MRMR Posts: 46
    edited 2007-11-17 19:25
    There is only one problem that remains,

    I issue the appropriate binary nibble DIRD=%0001 to the displays which are connected to a 7447 decoder, then I pause the program for a moment to allow the digit to stay lit, then I turn off the digit and proceed to the next digit. The problem, the displays flickers, all thirteen 7 segment displays appear to be solid but the displays look like they bounce. I am trying to figure out the duty cycle needed to eliminate this flicker. Currently I only pause 1. anything higher will cause greater flicker.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-11-17 19:55
    Hi MR, the instruction DIRD determines whether P12-P15 are inputs or outputs, to change the state of those outputs you use the instruction OUTD.

    So for example if you are using P12-P15 as switching outputs you would declare DIRD = %1111 then in your code you would use OUTD=hour1, OUTD=hour2 etc.

    Jeff T.
Sign In or Register to comment.