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

Thread Starter

gte

Joined Sep 18, 2009
357
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!
 

marshallf3

Joined Jul 26, 2010
2,358
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.
 

Thread Starter

gte

Joined Sep 18, 2009
357
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.
 
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
 

marshallf3

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

I'd like to control 8 individual LED's using 3 or 4 input pins to a component.
So what exactly are you expecting this to do?
 

Thread Starter

gte

Joined Sep 18, 2009
357
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!



For example, MM74HC164 can supply 25 mA per pin. Should do.
 

Thread Starter

gte

Joined Sep 18, 2009
357
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?




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?
 

marshallf3

Joined Jul 26, 2010
2,358
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.
 

Thread Starter

gte

Joined Sep 18, 2009
357
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!




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.
 
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!
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
 

marshallf3

Joined Jul 26, 2010
2,358
Thanks!
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.
Sounds like you now have enough input from everyone that's posted to get something working - have fun!
 

Papabravo

Joined Feb 24, 2006
21,228
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.
 
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.
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.
 

Thread Starter

gte

Joined Sep 18, 2009
357
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



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
 
Top