Has anyone ever used a 7 seg BCD to control individual LED's?

Discussion in 'General Electronics Chat' started by gte, Aug 15, 2010.

  1. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    Has anyone ever done this?

    I'd like to control 8 individual LED's using 3 or 4 input pins to a component.

    Any ideas? I searched and did not find anything.

    Thanks for reading!
     
  2. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    I found this, it is for 6 LED's ... is there no way to use all 2^3?

    Also, is there a piece of hardware that does this aside from multiple transistors, so I don't have to worry about providing current via my micro controller?

    [​IMG][​IMG]

    http://www.josepino.com/microcontroller/how_control_leds

     
    Last edited: Aug 16, 2010
  3. marshallf3

    Well-Known Member

    Jul 26, 2010
    2,358
    201
    Shouldn't be a problem, a 7 segment display is nothing more than 7 or 8 LEDs (if it has the decimal point) with a common cathode or anode depending on the design.

    People used to do this all the time when building digital clocks was all the rage so they could get a bigger display, of course a lot of the designs used several LEDs per segment so driver transistors were added. There was probably also a short period in which decoder ICs were available with the outputs "strobed" at a rate a bit higher than 10 Hz to lessen the driving current required, the human eye really can't distinguish between on and off much past 10 Hz.
     
  4. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    Thanks for the reply. It looks like the BCD's are designed to output to more then 1 segment, depending on the binary input they get, so there appears to be no way around that.

    I can't seem to find anything specifically designed to do this yet either :( I know I could charlieplex, but that is kind of confusing and I'd rather just add a small component for that that has it's own power source and sink, so it acted as a driver as well.
     
  5. sage.radachowsky

    Member

    May 11, 2010
    241
    38
    Try a shift register. With 3 pins you can control 8 LEDs. You can also daisy-chain them so you can have 16, 24, 32 LEDs with the same 3 pins. If the outputs can source or sink enough current then you can drive the LEDs directly.

    Sage
     
    gte likes this.
  6. sage.radachowsky

    Member

    May 11, 2010
    241
    38
    For example, MM74HC164 can supply 25 mA per pin. Should do.
     
    gte likes this.
  7. marshallf3

    Well-Known Member

    Jul 26, 2010
    2,358
    201
    There's a BCD to decimal decoder chip that has 10 outputs representing 0 - 9 one at time.

    So what exactly are you expecting this to do?
     
  8. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    Hi, thanks for the reply.

    I'm going to try and figure out how this whole serial thing works :) and how it correlates to the truth table on the data sheet. From it I cannot tell if I can illuminate the LED's individually based on the state of the 3 pins or not, but that is because this is my first time working with this, so I'll keep reading about it tonight and hope a light bulb goes off!



     
  9. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    Based on an input button to my microcontroller, I'd like it to illuminate 1 LED at a time, depending on how many times it is pushed. Basically like a cycle, it will cycle through to the next LED each time the button is pressed.

    Do you have an example of the BCD with 10 outputs?




     
  10. marshallf3

    Well-Known Member

    Jul 26, 2010
    2,358
    201
    Funny what Google can find in 0.2 seconds.

    SN74141N, MC14028B, CD74HC42M etc. or generically 74141, 4028 & 7442

    This is probably what you've been looking for but if you don't have a counting BCD circuit output from the uC then you'd want to use simple shift register as metioned above, it will advance one position for each button push.
     
    gte likes this.
  11. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    Thanks!

    I know I should be able to google it, but I'm apparently not using the correct keywords because I wasn't getting decent results.

    When you say "don't have a counting BCD circuit output from the uC" . Do you mean if I do not have it coded into the microcontroller to count the button presses? I do have a case statement that right now is counting each button press and advancing by one each time, and it is working but it also is using 8 microcontroller pins, 1 for each LED output and of course with this I'm trying to condense that.

    Thank you for the help!




     
  12. sage.radachowsky

    Member

    May 11, 2010
    241
    38
    Hi gte,

    The answer to this is that yes, you can illuminate any combination of LEDs you want to.

    The one I linked to is not the best one for the job. That one doesn't have latching, and it has 2 inputs, which you don't need.

    Here's a good one: MM74HC595. The data sheet has a better block diagram and a nice timing diagram. (However, there are some typos / error on the timing diagram -- the second "OA" should be "OB" and it should go low when RCK goes high.

    You'll want to connect the microcontroller output pins to RCK, SCK, and SER. It is easiest if they are on the same port so you can write them all with one write instruction. You'll want to tie off the "_G_" to Gnd "_SCLR_" to the supply voltage, to keep the outputs enabled and not clearing them.

    The you write the microcontroller code for this:

    Set CLK low, while setting the data for the first bit on SER. Then set clock high while keeping the data the same on SER. Then repeat this 8 times for each new bit. That sends the 8 bits into the 8 latches.

    Then set RCK high, and all the bits should then appear at the outputs of the shift register chip. Simple as that!

    That can all occur very fast, each step being about 1 microsecond, so the total thing takes around 20 microseconds to change all 8 bits.


    Sage
     
    gte likes this.
  13. marshallf3

    Well-Known Member

    Jul 26, 2010
    2,358
    201
    Sounds like you now have enough input from everyone that's posted to get something working - have fun!
     
    gte likes this.
  14. Papabravo

    Expert

    Feb 24, 2006
    10,152
    1,794
    For you next project you might want to google "charlieplexing" and use a MAX6954 for controlling individual LEDS or segmented devices. They provide constant current drive and duty cycle control and work from a wide range of voltages.
     
    gte likes this.
  15. blueduck577

    New Member

    Aug 11, 2010
    2
    1
    This chip is exactly what you are looking for: the 4017 decade counter. basically has ten outputs which go HIGH in sequence when a source of pulses is connected to the CLOCK input.
     
    gte likes this.
  16. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    Only one goes high at a time though. It sequences through the pins.
     
    gte likes this.
  17. gte

    Thread Starter Active Member

    Sep 18, 2009
    347
    4
    Thanks for taking the time to explain this sage, I think I understand :)

    I can't wait to experiment and get this up and running!

    Thanks again



     
  18. peranders

    Well-Known Member

    May 21, 2007
    87
    0
Loading...