7 segment multiplexing

Thread Starter

Abdullah Razzaq 1

Joined Feb 28, 2019
9
I am trying to interface 74ls145 with 8051 microcontroller to operate 6 seven segment digit multiplexing, any body would like to send me the source code in c language for this purpose please.
 

MrChips

Joined Oct 2, 2009
23,090
It ain't gonna happen.
That is not how AAC works. Writing code for this is like teaching a toddler how to walk. You have to start learning to do the simple things on your own.

Do you know how to program an 8051 MCU?
Which MCU variety are you using?
What IDE platform are you running?
How does 74LS145 work?
How does multiplexing work?
Where is your circuit diagram?
 

Thread Starter

Abdullah Razzaq 1

Joined Feb 28, 2019
9
It ain't gonna happen.
That is not how AAC works. Writing code for this is like teaching a toddler how to walk. You have to start learning to do the simple things on your own.

Do you know how to program an 8051 MCU?
Which MCU variety are you using?
What IDE platform are you running?
How does 74LS145 work?
How does multiplexing work?
Where is your circuit diagram?
I am using kiel ide for programming.

I am using keil ide and designing on proteus, using at89c51 mcu.
 
Last edited by a moderator:

Thread Starter

Abdullah Razzaq 1

Joined Feb 28, 2019
9
I am trying to interface 74ls145 with 8051 microcontroller to operate 6 seven segment digit multiplexing, any body would like to send me the source code in c language for this purpose please.
I am using single digit common cathode seven segment which are total 6 in quantity, common pin of every segment is connected to the 6 outputs of the decoder(74ls145), it receives input but do not give any output to the ssd.
 

pmd34

Joined Feb 22, 2014
518
Each anode pin (a b c d.. etc.) for each segment of display connects to the relevant pin (via a resistor) on the 74LS145. To multiplex them, you use the microcontroller to switch between each of the cathode pins of the displays. Setting the common cathode to 0V will then light up that display with the current number set on the inputs of the 74LS145
 

jfitter

Joined Mar 14, 2019
14
The decoder you are using is open collector so you must ensure there is a power source for the LEDs - the decoder will not source power - the CPU can be the source but don't kill it. If you have done this then just send out the digits 4-bits at a time at a rate of about 1kHz. Make certain that there is a small delay between digits, where all digits are off, of around 100uS or so, otherwise you will get ghosting.
The use of the decoder presumes you are short of CPU pins or tight on code. If neither apply then don't bother with the decoder and drive the segments directly, decoding with a lookup table. You are not saving the CPU with a decoder because the decoder does not source power.
You should have a digit driver for each digit. A common "garden variety" BJT usually does the trick, say a BC337 or BC336. You drive the digits from a port by shifting or rotating a bit through it.
Turn off the segments, shift the bit in the digit select register, wait 100uS, then turn on the segments for the next digit.
 

Ian Rogers

Joined Dec 12, 2012
850
As Mr chips said... Do a screen shot in ISIS... I have tutorials for the 8051 on ETO and I have similar for the PIC.. There are examples that will do everything you ask for..... BUT!! we need to know the 7 seg connections to the shift registers before we comment!!
 

Ian Rogers

Joined Dec 12, 2012
850
Okay... Yes the resistor network may be needed as the P0 might be open collector.. The 74hc574 is also needed as the micro cannot give enough current to light the Led's… Have you selected the common cathode display's?...

I will say one thing... Multiplexing these modules on Proteus isn't pretty... You will have to edit the displays to operate quicker or you won't see anything. In the library there are bussed displays that will work far better.. I have done this but you have to turn the contrast down on the LCD screen to see the results.... If you intend to make these I would suggest a load and lock shift register for each display and load it serially..

Have you written some code? If so! Have you polled the display's or are you using a timer interrupt? Timing will be the issue.. It will be okay in the real world, but Proteus will be difficult...
 

pmd34

Joined Feb 22, 2014
518
Sorry, MMcLaren your are right its the 4511 you need for common cathode applications, but apart from ABDEF there is really not much else you can display with a 7 segment, so 0-9 is usually enough!
 

Ian Rogers

Joined Dec 12, 2012
850
Sorry, MMcLaren your are right its the 4511 you need for common cathode applications, but apart from ABDEF there is really not much else you can display with a 7 segment, so 0-9 is usually enough!
Struggling a bit here... Mike hasn't commented on this thread... I normally use common anode displays and 74hc595's, the storage keeps the led's lit..
 

djsfantasi

Joined Apr 11, 2010
7,563
Sorry, MMcLaren your are right its the 4511 you need for common cathode applications, but apart from ABDEF there is really not much else you can display with a 7 segment, so 0-9 is usually enough!
If you don’t use a display driver IC and use a table lookup on a micro, you can also get HIJLOPSU... :rolleyes:
 

djsfantasi

Joined Apr 11, 2010
7,563
...and multiplexing 6 digits only requires 10 pins. I’m not familiar with the 8051, but ATMega’s have Port IO, so setting the 7-segment data is one statement (in C). And the same can be done for digit selection.
 

Thread Starter

Abdullah Razzaq 1

Joined Feb 28, 2019
9
Ya I am using common cathode 7 segment
Okay... Yes the resistor network may be needed as the P0 might be open collector.. The 74hc574 is also needed as the micro cannot give enough current to light the Led's… Have you selected the common cathode display's?...

I will say one thing... Multiplexing these modules on Proteus isn't pretty... You will have to edit the displays to operate quicker or you won't see anything. In the library there are bussed displays that will work far better.. I have done this but you have to turn the contrast down on the LCD screen to see the results.... If you intend to make these I would suggest a load and lock shift register for each display and load it serially..

Have you written some code? If so! Have you polled the display's or are you using a timer interrupt? Timing will be the issue.. It will be okay in the real world, but Proteus will be difficult...
 

Thread Starter

Abdullah Razzaq 1

Joined Feb 28, 2019
9
I couldn't turn on or switch the displays by using 74ls145 as its deliver nothing to the ssd, I think it's a fault of proper timing, as in this project I m using 74ls145 to switch between the ssd and have to give supply to the common pins of the cathode displays, on the other hand I use hc574 to enables the other pins like(a,b,c,d,e,f), but I am unable to interface the 74ls145, please send me the code with proper timer interrupts which will enable the ssd, I just want to show all of six digits like this(123456), please i requested all of you experts. Thank you.
 
Top