1
\$\begingroup\$

I am using this code with a 74HC595 IC to control a 4 digit 7-segment:

digitalWrite(latchPin, LOW);                                          
shiftOut(dataPin, clockPin, LSBFIRST, "value");      
digitalWrite(latchPin, HIGH);

I understand what the shiftout() does, but I don't understand why we need to put the latch pin low and then high. Can somebody explain this to me?

The latch pin is pin 12 on the 74HC595 IC.

\$\endgroup\$
1
  • 3
    \$\begingroup\$ This question should not be tagged Arduino as it is about a TTL logic IC. Also, the 74HC959, as mentioned in the title and in the text. does not exist and should be 74HC595, probably. \$\endgroup\$
    – StarCat
    May 20 at 13:55
1
\$\begingroup\$

Here is a snapshot from the datasheet:

datasheet

Note: I feel you have mentioned an incorrect part number in your question. Correct part number should be 595 rather than 959.

Coming back to datasheet, a low to high transition on RCLK pin is required to sotre the data in the storage register. That's why you pull the pin LOW and then set it HIGH. Upward arrow indicates LOW to HIGH transition.

\$\endgroup\$
1
\$\begingroup\$

A positive edge (that is, an input going from low to high) on the "latch" (RCLK, pin 12*) pin of the 74HC595 transfers the 8 bits of data that have been shifted in via the SER pin (pin 14*), from the shift register to the parallel output storage register that controls the 8 parallel outputs (when /OE is low).

This is done so the output of the 74HC595 remains stable, while shifting in the next 8 bits of data to be output. This also allows multiple 74HC595s to be cascaded, while being able tp simultaneously update the output of every 74HC595 in the chain.

The 74HC595 Data sheet explains how this works.

enter image description here

(From the Texas Instruments 74HC595 Data Sheet)

*DIP package

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.