The 74HC595 series-parallel converter

published: 18 November 2019 / updated 18 November 2019

Lire cette page en français

 

The 74HC595 converter

Find all the explanations on the 74HC595 converter here:
  The 74HC595 series-parallel converter

Manage eight LEDs

We will manage eight LEds, wired as follows:

74HC595 connection to 8 LEDs

We alternated 4 white LEDs and 4 blue LEDs.

Here is a first word to test the proper functioning of our LEDs:

: test.LEDs ( ---) 
    init.74HC595 
    %00000001 csend 300 ms 
    %00000010 csend 300 ms 
    %00000100 csend 300 ms 
    %00001000 csend 300 ms 
    %00010000 csend 300 ms 
    %00100000 csend 300 ms 
    %01000000 csend 300 ms 
    %10000000 csend 300 ms 
    %00000000 csend         \ turn all LEDS off 
  ; 

Running test.LEDs turns each LED from left to right.

The word csend accepts any value between 0 and 255:

All other values between 0 and 255 light the lEDs according to the binary content the value passed to the csend word.

American police way flashing

In American movies, we often see unmarked FBI vehicles that have rather characteristic flashes placed in the hood. here's how simulate this blinking:

: led.fbi ( ---) 
    init.74HC595 
    begin 
        8 for 
            %01010101 csend 60 ms 
            %00000000 csend 80 ms 
        next 
        %10101010 csend 300 ms 
    key? until 
    %00000000 csend         \ turn all LEDS off 
  ; 

Scrolling LEDs like emergency vehicle

Here is a scrolling that could look like what illuminates an emergency vehicle in intervention:

: led.fire ( ---) 
    init.74HC595 
    begin 
        %10000000 csend 60 ms 
        %11000000 csend 60 ms 
        %01100000 csend 60 ms 
        %00110000 csend 60 ms 
        %00011000 csend 60 ms 
        %00001100 csend 60 ms 
        %00000110 csend 60 ms 
        %00000011 csend 60 ms 
        %00000001 csend 60 ms 
        %00000011 csend 60 ms 
        %00000110 csend 60 ms 
        %00001100 csend 60 ms 
        %00011000 csend 60 ms 
        %00110000 csend 60 ms 
        %01100000 csend 60 ms 
        %11000000 csend 60 ms 
    key? until 
    %00000000 csend         \ turn all LEDS off 
  ; 
clignotement façon véhicule d'urgence

Potential

As examples, we managed eight LEDs.

In fact, we can handle many other components, especially these famous displays LED 7 segments (8 LEDs with the decimal point).

But what is even more interesting is the fact of being able to manage several 74HC595 converters:

chaining of several converters 74HC595

The Q7 output is in duplicate on the 74HC595 converter: pin 7 and pin 9.

When injecting each bit into the first 74HC595 converter, the content previously transmitted is "pushed" into the second converter 74HC595 via this pin 7 to the pin DS of the next converter, which pushes its content into the third converter 74HC595, and so on.

If we manage four chained 74HC595 converters as described in the diagram above, it suffices to transmit four successive values:

: csend4 ( c1 c2 c3 c4 ---) 
    csend csend csend csend  
  ; 
\ example: 1 3 7 15 csend4 

Complete source code

The complete listing is available here: Examples using 74HC595 chip