74hc595: all about the shift register IC

El 74HC595 chipAs it is deduced from its name, it is a printed circuit that implements a CMOS circuit inside. Specifically, it is a shift register. For those who do not yet know these registers, it is basically a sequential digital circuit, that is, its values ​​at the output simply depend on the input values ​​and previous stored values.

That differentiates them from combinationals, that the outputs only depend on the value of the input. This register is made up of a series of D-type flip-flops or flip-flops commanded by a clock signal. Those flip flops are memories that keep a previous value. Each one stores a bit and, from its name, you can also deduce that it can shift them. By running the bits from one side to the other we can do quite interesting digital operations.

Shift register types

Shift register diagram

According to type of displacement that they do on the bits they store, the registers can be of various types. They are capable of moving left or right, some bidirectional, but the order is what will determine the type, even in other cases they are also cataloged based on how the inputs and outputs are:

  • Series-Series: those in which only the first flip-flop receives data and they go in series until the complete register is filled. The last flip-flop is the one that is directly connected to the output and through which the register will be exited.
  • Parallel-series: the bits go in in parallel to be stored at the same time in all the flip-flops, but then they go out in series. They can be used to convert from series to parallel and vice versa.
  • Series-Parallel: similar to the previous one, all the outputs are accessible at the same time from all the flip-flops. But the data will enter only by the first in series.
  • Parallel-parallel: Data is going in parallel and going out in parallel.

Among the best known circuits we have the 74HC595, 74HC164, 74HC165, 74HC194, etc. The 194 is universal, it can be configured as we want. On the other hand, we have other bi-directional ones such as 165 and 164, so it moves to the left or right, as specified with the direction control signal, but they only have one configuration: parallel inputs and serial output, and serial input and parallel output. respectively.

l298n
Related article:
L298N: module to control motors for Arduino

What is a shift register for?

Why shift bits? Shifting data bits can be very practical. One reason is that you need to shift the values ​​for a specific purpose. But shifting also involves performing some operations on the stored bits. For example, shifting a set of bits to the left is like multiplying them by 2. Shifting them right is like dividing by 2. Therefore, to do binary multiplication and division they can be very practical ...

They are also used to generate pseudo-random values, for successive approximations widely used in analog / digital converters, to delay, etc. The uses in logic digital circuits it is quite common, so it is not uncommon to have to use them in some project.

74HC595 Features

74HC595 pin-out

El 74HC595 is a fairly straightforward IC. It is an 8-bit shift register, that is, it has 8 flip-flops to store 8 bits. The pin-out or pins of this chip can be seen in the image above, with Vcc and GND for power, and then those marked as Q which are the data. The rest correspond to clock / control signals.

All the input has it in series and output in parallel. Therefore, with a single input, these 8 outputs can be controlled at the same time. You will only need three pins from the used microcontroller (eg: Arduino) to drive it. Those are Latch, Clock and Data. Latch is pin 13 in this case, although it may vary, so you should consult your manufacturer's datasheet. Clock can be 11 or others, and the data bit is 14.

La clock sign it will feed the circuit to determine the beat or rhythm at which it will work. The data output will change the behavior of the chip. For example, when changing from LOW to HIGH and generating the new clock pulse by passing the clock from HIGH to LOW, what is achieved is to record the current position where the displacement is located, the value entered by this data pin. If you repeat this 8 times, then you will have recorded all 8 positions and have one byte stored (Q0-Q7).

Use with Arduino

Arduino with the 74hc595

To make it clearer, maybe an example with Arduino It explains it to you in a more intuitive and graphical way than starting to launch theoretical data. For example, you can create a simple circuit with Arduino and a 74HC595 shift register to play with some lights or LEDs. Another somewhat better and simpler option is to use a 7-segment display to read the values ​​from the register.

2n2222 transistor
Related article:
2N2222 transistor: everything you need to know

The diagram is the one you can see in the previous image, once the Arduino is connected in that way with the 74HC595 and the display, It only remains to program it with the Arduino IDE and we will see the possibilities of the shift register. The code would be the following, with a series of binary codes 0bxxxxxxxx, where x bits:

const int latchPin = 8;  // Pin conectado al Pin 12 del 74HC595 (Latch)
const int dataPin  = 9;  // Pin conectado al Pin 14 del 74HC595 (Data)
const int clockPin = 10; // Pin conectado al Pin 11 del 74HC595 (Clock)
int i =0;
                      
const byte numeros[16] = {
                0b11111100,
                0b01100000,
                0b11011010,
                0b11110010,
                0b01100110,
                0b10110110,
                0b10111110,
                0b11100000,
                0b11111110,
                0b11100110,
                0b11101110,
                0b00111110,
                0b10011100,
                0b01111010,
                0b10011110,
                0b10001110
};
                      
void setup() { 
  Serial.begin(9600);
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT); 
}

void loop() {

                for (i=0;i<16;i++) {
                               delay(1000);
                               digitalWrite(latchPin, LOW);
                               shiftOut(dataPin, clockPin, LSBFIRST, numeros[i]);
                               digitalWrite(latchPin, HIGH);
                }
}

Datasheet

pin board

In the market you will find different 74HC595 chips from different manufacturers. One of them is the mythical Texas Instruments or Ti, but be that as it may, each manufacturer should offer you the datasheet to download from its official website. You can also find some others like the one in ON Semiconductor, Sparkfun, STMicroelectronics, NXP, etc


Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.