7 segment multiplexing

Discussion in 'Embedded Systems and Microcontrollers' started by Abdullah Razzaq 1, Feb 28, 2019.

  1. Abdullah Razzaq 1

    Thread Starter New Member

    Feb 28, 2019
    9
    0
    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.
     
  2. MrChips

    Moderator

    Oct 2, 2009
    18,891
    6,051
    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?
     
    AlbertHall, DickCappels and pmd34 like this.
  3. Abdullah Razzaq 1

    Thread Starter New Member

    Feb 28, 2019
    9
    0
    I am using kiel ide for programming.

    I am using keil ide and designing on proteus, using at89c51 mcu.
     
    Last edited by a moderator: Feb 28, 2019
  4. Abdullah Razzaq 1

    Thread Starter New Member

    Feb 28, 2019
    9
    0
    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.
     
  5. MrChips

    Moderator

    Oct 2, 2009
    18,891
    6,051
    Please show your circuit schematic.
    And then show the code that you have written so far.
     
  6. pmd34

    Active Member

    Feb 22, 2014
    361
    153
    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
     
  7. jfitter

    New Member

    Mar 14, 2019
    14
    9
    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.
     
  8. Ian Rogers

    Well-Known Member

    Dec 12, 2012
    628
    169
    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!!
     
  9. Abdullah Razzaq 1

    Thread Starter New Member

    Feb 28, 2019
    9
    0
    g.jpg
     
  10. Abdullah Razzaq 1

    Thread Starter New Member

    Feb 28, 2019
    9
    0
     
    • g.jpg
      g.jpg
      File size:
      231.2 KB
      Views:
      3
  11. Abdullah Razzaq 1

    Thread Starter New Member

    Feb 28, 2019
    9
    0
    g.jpg
     
  12. pmd34

    Active Member

    Feb 22, 2014
    361
    153
    Erm, what is the purpose of u2 and rn1? These are not needed. The resistors r2 etc should be about 300 ohm ish.
     
  13. Ian Rogers

    Well-Known Member

    Dec 12, 2012
    628
    169
    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...
     
  14. pmd34

    Active Member

    Feb 22, 2014
    361
    153
    By far the best way of multiplexing is to use the 74LS47 instead of U2 for example.
     
  15. pmd34

    Active Member

    Feb 22, 2014
    361
    153
    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!
     
  16. Ian Rogers

    Well-Known Member

    Dec 12, 2012
    628
    169
    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..
     
  17. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    5,313
    2,005
    If you don’t use a display driver IC and use a table lookup on a micro, you can also get HIJLOPSU... :rolleyes:
     
  18. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    5,313
    2,005
    ...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.
     
  19. Abdullah Razzaq 1

    Thread Starter New Member

    Feb 28, 2019
    9
    0
    Ya I am using common cathode 7 segment
     
  20. Abdullah Razzaq 1

    Thread Starter New Member

    Feb 28, 2019
    9
    0
    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.
     
Loading...