Menu

Controlling an 8-digit 7-segment LED display that uses the 74hc595 devices

2022-11-05
2022-11-06
  • Harley Burton

    Harley Burton - 2022-11-05

    I want to feed digits to an 8-digit 7-segment display that uses the 74hc595 devices. GCB will support 4-digit devices, does anyone have an idea how to expand this to 8-digit devices. These are really cheap and would be very good to use.

    Thanks,

    Harley

     
  • mkstevo

    mkstevo - 2022-11-05

    I've certainly posted a few designs that use the 74HC595 devices, using them to drive 7 segment displays. The most 595s I have used at once is five (for my Dekatron clock) though there is no reason whatsoever that they couldn't be extended further.

    I'm sure I posted a few methods of using LED 7 segment displays somewhere...
    This is the base method I use for all my 74HC595 displays: https://sourceforge.net/p/gcbasic/discussion/629990/thread/23701771/?limit=250#b68b

    For additional displays, simply add more displays and then send more data. Each call to 'ShiftOut' will send one byte, illuminating one display whilst at the same time transferring the "previous" information displayed in the first "digit" into the second "digit". Further calls to ShiftOut move the "digits" on the displays up once again. After eight calls to ShiftOut there would be enough data to display all eight digits. Further calls would cause the final digit to move off the end of the display and be replaced by the data in the previous digit.

    Assuming you have eight displays, and they were wired such that the left most display was the first.
    Initially the display would look like this: (I'm going to indicate a blank display with - )

    -------- (All blank)
    If you were to display a message of "HELLO GCB", after the first call to ShiftOut you'd have:
    -------H
    then
    ------HE
    then
    -----HEL
    ----HELL
    ---HELLO
    -- HELLO-
    -HELLO-G
    HELLO-GC
    ELLO-GCB

    If you send your eight display bytes at once, and arrange your program something like this:

    'Psuedo code - digit1, digit2 etc. need to be declared and initialised
    'ShiftOut is demonstrated in the linked post
     Let D_Lat  = 0                'Start output data latch  
     ShiftOut(Digit1)
     ShiftOut(Digit2)
     ShiftOut(Digit3)
     ShiftOut(Digit4)
     ShiftOut(Digit5)
     ShiftOut(Digit6)
     ShiftOut(Digit7)
     ShiftOut(Digit8)
     Let D_Lat  = 1                'End output data latch
    

    Sending the closing 'Latch' only after all digits have been sent, the display would appear to update instantaneously.

    If you send each digit one at a time with the opening and closing 'Latch' statements surrounding them along with a suitable delay, the data would appear to scroll across the display:

    'Psuedo code - digit1, digit2 etc. need to be declared and initialised
    'ShiftOut is demonstrated in the linked post
    Let D_Lat  = 0                'Start output data latch  
    ShiftOut(Digit1)
    Let D_Lat  = 1                'End output data latch
    Wait 100 mS
    Let D_Lat  = 0                'Start output data latch
    ShiftOut(Digit2)
    Let D_Lat  = 1                'End output data latch
    Wait 100 mS
    Let D_Lat  = 0                'Start output data latch
    ShiftOut(Digit3)
    Let D_Lat  = 1                'End output data latch
    Wait 100 mS
    Let D_Lat  = 0                'Start output data latch
    ShiftOut(Digit4)
    Let D_Lat  = 1                'End output data latch
    Wait 100 mS
    Let D_Lat  = 0                'Start output data latch
    ShiftOut(Digit5)
    Let D_Lat  = 1                'End output data latch
    Wait 100 mS
    Let D_Lat  = 0                'Start output data latch
    ShiftOut(Digit6)
    Let D_Lat  = 1                'End output data latch
    Wait 100 mS
    Let D_Lat  = 0                'Start output data latch
    ShiftOut(Digit7)
    Let D_Lat  = 1                'End output data latch
    Wait 100 mS
    Let D_Lat  = 0                'Start output data latch
    ShiftOut(Digit8)
    Let D_Lat  = 1                'End output data latch
    

    Hope that gives you some ideas.

    I should add that I used Common Anode LED displays. For Common Cathode displays, the values in the tables from the post I linked to would need inverting to illuminate the correct segments.

     

    Last edit: mkstevo 2022-11-05
  • Anobium

    Anobium - 2022-11-05

    Check the Help. Look up LCD_IO 1

    The Help has the detailed circuit and the example code. Once connected you can use the standard LCD Print command set.

    The Help is avaialbe via F1 in GCStudio or online https://gcbasic.sourceforge.net/help/_lcd_io_1.html

     
    • mkstevo

      mkstevo - 2022-11-05

      Does that method work for seven segment LED displays (Common Anode or Common Cathode types)? I had assumed it related to LCD 16x2, 20x2 etc. character type displays?

       
      • Anobium

        Anobium - 2022-11-05

        The process is the same.

        Hook into the LCD command set and send to the 7Segment.

        The best person to ask would be ToniG. He is the resident expert.

         
  • mmotte

    mmotte - 2022-11-06

    Harley,
    for 8 digit 7 seg LED I use the inexpensive max 7219 modules. During this past year we have improved the library. look in the forum. Don't get confused, there is max7219 dot matrix modules and max7219 7 seg led modules. They are driven with a clk , a data ,and a CS signal. 3 wires.

    mike w9ys

     

Log in to post a comment.