Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

7 segment display with less pins

Status
Not open for further replies.

bananasiong

New Member
Hi,
If I want to display number or anything with 7 segment display, I need 8 pins. If I use 8 pins directly from the microcontroller, my i/o pins are wasted.
I've found a method: using serial in to parallel out shift register, 74ls164. According to the datasheet, there are 2 input pins, but I can't figure out how to use 2 pins as input. I thought I just need a clock, and serial input data?
Another method I found is, multiplexing by using the microcontroller, but I don't know how to connect them up and any additional hardware needed.

Can anyone tell me, or better method?

Thanks
 
Hi,
There are many different 'shift reigsters', 4094 has worked for me, as well as the 74xx164. You should only need a clock and a data line, but you might also need a 'strobe' line if your shift-register has a latch, so that the data is loaded to the outputs at the same time.

If you've got more than one seven segment display then you can multiplex these, however you'll still require pins for the segments, as well as a common anode/cathode for each display. This can be done with a 3-8 line decoder, or a decade counter OR a johnson counter (so many ways with logic).

You are right btw, you will need 8 I/O's (if you include the decimal point) to display Anything, ie: any combination of segments on/off. For just numbers and if you're limited on I/O's, you might as well just get a 7-seg decoder in logic. There are many things a micro could do to multiplex inputs and google (and this board) has many examples, so I won't go into details here.

Looking at the data sheet for that particular shift register, the two input pins are the inputs of a NAND gate, the output of which goes through an inverter to the 'set' part of a flipflop, and the non-inverted part to the 'reset'. So, as you probably know, a 'NAND' is simply an AND gate with an inverted output. And because the output of this is inverted AGAIN, they cancel. So with the AND gate's inputs, one can be used as the data line, and the other as an 'enable'. When the enable is low, the output of the NAND gate will always be 0, regardless of whats on the data line, so when you clock the SR, you'll just be clocking in 0's. When enable is high, the output is what the data input is.

That particular shiftregister isn't buffered, meaning the parallel outputs will change every time you clock in a data bit. A buffered SR, or one with a latch would probably be better, the parallel output would remain the same until you send the strobe (or 'LOAD') line high, which loads in the connts of the shift register to the output.

Its pretty simple, thats why they have logic diagrams in datasheets, so you know exactly whats going on. Also, if you're using a microcontorller, with an SPI peripheral, then SPI can be used for shift registers easily. And with additional logic, such as a 3-8 line decoder, you could have multiple 'CS' lines for strobing the data out. The possibilities are mind boggling, I/O expansion up to 128 I/O's is easily possible with the minimum of coding, it just depends on what these I/O's are used for.

My two cents,

Blueteeth
 
Thanks for replying :)
I think I'll go for multiplexing first, if I fail to learn it, then I'll choose using shift register.

Thanks
 
A 4511 7 segment display driver takes a 4 bit number, holds and displays it. If you use gates to address that chip, like a 4 input AND gate, as long as you avoid that number you still have the 8 pins to do other things. There is probably a TTL equivalent.
 
Another method

In the picture u will see another method.
I don't know it is new or it is already done by others.
May this work for u.

exprienced members plz check this circuit, it will work or not???
 

Attachments

  • picture7segtouc.GIF
    picture7segtouc.GIF
    15.4 KB · Views: 1,774
There's a method called Charlie plexing which I guess some MAX display drivers use that is the most I/O pin efficient method of driving 7 segment (or similar) displays. The WikiPedia entry gives you a quick description of it, and if you search for Charlieplexing (one word) on google the first link you find should be a Maxim's appnote that describes the multiplexing method and it's advantages/limitations.
 
Hey, I found a problem here:
**broken link removed**

If I want to turn segment a of 1st display on and segment b of 2nd display on, cathode 1 & 2 should be low and segment a and b should be high. But this will make both segment a & b of 1st and 2nd display to turn on.
Or should I turn 1st display on followed by the 2nd display very fast using programming? Otherwise I've no idea how to do this.

Thanks
 
With multiplexing you turn on one display at a time with its common pin and step through them all one after the other.
Each one is lighted for a small percentage of the total time so the current must be increased by the same ratio for them to be bright.
 
audioguru said:
Each one is lighted for a small percentage of the total time so the current must be increased by the same ratio for them to be bright.
Do you mean, the limiting current resistors have to be very small? 100:eek:hm:?
 
For 8 displays you need 8 times the current, as it's shared between the 8 displays. The value of the resistor depends on the supply voltage, and the current you want.
 
A 4511 7 segment display driver takes a 4 bit number, holds and displays it. If you use gates to address that chip…..
If you only need 2 digits, use 2 4511 7 segment display drivers with different addresses. When you want to change the numbers just address them and give them a new number. Otherwise all 8 pins are free to do other things and you won’t spend all of your time displaying numbers.
 
I'm using PIC microcontroller. I haven't decided how many pins are used for I/O, and I don't know whether I have enough pin for the 7 segment displays or not. So I have to learn both the methods: Multiplexing and driver / shift register.

If I use multiplexing, I think I'll go for sinking the current, since more current needed for more displays.
 
you cud just use the 74xx48 or 74xx48....i think they call it 7 segment decoder...so that you cud only use 4 i/o pins from your microcontroler..
 
Banana,

Have a look at the MM5450 and MM5451, these chips are intended to drive 34 LEDs, you will only need 2/3 I/O lines from your micro, and the LEDs are not multilplexed, so you dont need to drive the with high currents.

JimB
 
Thanks, I've read through the datasheet of mm5450, it has only one input pin? If I'm not using all the output pins, should the serial code be '0's at the back part?
Another application shown on the datasheet is digital clock which is what I'm planning to do, is there any special functionfrom this IC for digital clock? Or it is just for displaying?
If I use only microcontroller, without using any 7 segment display driver, will it be difficult?

Thanks.
 
The 5450 can be used for anything, it has no special functions, it will not implement a clock without being driven by microprocessor.

The 5450 is a 34/35 bit shift register and (led) driver.

When you drive the 5450 from your micro, shift and clock in the whole 34/35 bits, set the bits to 0/1 for the pins you are using, the bits for the other bits can be anything if the output pins are not connected.

JimB
 
Hi, I got what you mean, thanks.
But I think my PIC has enough I/O pins for displaying four 7 segment display (not one pin to one segment but using multiplexing)
Let's say if I make a digital clock with additional function, count down timer, the program for getting input signal and some other program take very small interval of time, so the delay time for the clock should be decreased a little?
 
bananasiong said:
Hi, I got what you mean, thanks.
But I think my PIC has enough I/O pins for displaying four 7 segment display (not one pin to one segment but using multiplexing)
You need 11 pins, if you don't use the d.p. Which PIC have you chosen?

bananasiong said:
Let's say if I make a digital clock with additional function, count down timer, the program for getting input signal and some other program take very small interval of time, so the delay time for the clock should be decreased a little?
You should use interrupts if you want precise timing.
 
I'm using 16F877A, the I/O pins are more than enough.
I'm still learning how to program it from Nigel's tutorial. Is there any tutorial related to interrupts? Or Timing?

Thanks
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top