difference between 74HC595 and HD74LS164 ??

hello guys,
i went today and bought a shift register which is HD74LS164. It has 14 pins not a 16 pins, and all tutorials i have from arduino to adafruit use the 74HC595 with 16 pins, i checked the datasheet for HD74LS164 it has 2 pins called A and B Serial Inputs, the 74H has latch and data, so i need to know first what’s the real difference and if A and B pins are latch and data ?

here is the datasheet for HD74LS164

Shift Register HD74LS164P.pdf (91.2 KB)

The 74HC595 has: Tri-state outputs so they can share a bus with other chips. Not necessary. Just keep /OE LOW.

The HD74LS164: Has AND'd inputs (A and B). Not needed. Just set one HIGH and use the other. DOES NOT HAVE a Latch. This might be a problem because as you shift data in it appears on each output in turn. Might not be a problem is you shift data quickly (via the SPI hardware, for example) and you are just lighting LEDs.

johnwasser: The 74HC595 has: Tri-state outputs so they can share a bus with other chips. Not necessary. Just keep /OE LOW.

The HD74LS164: Has AND'd inputs (A and B). Not needed. Just set one HIGH and use the other. DOES NOT HAVE a Latch. This might be a problem because as you shift data in it appears on each output in turn. Might not be a problem is you shift data quickly (via the SPI hardware, for example) and you are just lighting LEDs.

i didn't get exactly what you mean in the second part but as i understand is that i can only light LEDs by series ? which means 1, 2, 3, 4 but every LED will light on it's own ? and about A and B i just put for example A HIGH and use B as an output that's what you mean ?

i can only light LEDs by series ? which means 1, 2, 3, 4 but every LED will light on it’s own ?

If you have LED’s connected to output pins 7,6,5,4,3,2,1,and 0 and you want to turn on 4 and 7 you would send a pattern of:

10010000

Let’s say that LEDs 3 and 2 are already lit (00001100).

As you shift the new pattern into the shift register the LEDs will be lit in the following patterns:

00011001
00110010
01100100
11001001
10010010
00100100
01001000
10010000

The end result is what you want but along the way some of the other LEDs will be briefly lit. If you use a relatively slow shifting method (like shiftOut()) the ghosting will be worse than if you use a very fast method (SPI can clock out bits at 8 million per second).

about A and B i just put for example A HIGH and use B as an output that’s what you mean ?

Yes. Connect A to +5 and connect B to your Data pin, or connect B to +5 and connect A to your Data pin, or connect both to your Data pin.

johnwasser:

i can only light LEDs by series ? which means 1, 2, 3, 4 but every LED will light on it's own ?

If you have LED's connected to output pins 7,6,5,4,3,2,1,and 0 and you want to turn on 4 and 7 you would send a pattern of:

10010000

Let's say that LEDs 3 and 2 are already lit (00001100).

As you shift the new pattern into the shift register the LEDs will be lit in the following patterns:

00011001 00110010 01100100 11001001 10010010 00100100 01001000 10010000

The end result is what you want but along the way some of the other LEDs will be briefly lit. If you use a relatively slow shifting method (like shiftOut()) the ghosting will be worse than if you use a very fast method (SPI can clock out bits at 8 million per second).

about A and B i just put for example A HIGH and use B as an output that's what you mean ?

Yes. Connect A to +5 and connect B to your Data pin, or connect B to +5 and connect A to your Data pin, or connect both to your Data pin.

ok thank you I will try it and see the results

The 595 has a separate latch between the shift register and the output pins, while the 164 is only a shift register. That means that when you shift data into a 164, the outputs change for each clock pulse, and will momentarily have values that aren't aimed at that pin. On a 595, you shift all 8 bits into the internal shift register, and then send a signal the latch, which will transfer the bits to the output pins in parallel, with the output pins only getting the values that were sent to those pins.

westfw: The 595 has a separate latch between the shift register and the output pins, while the 164 is only a shift register. That means that when you shift data into a 164, the outputs change for each clock pulse, and will momentarily have values that aren't aimed at that pin. On a 595, you shift all 8 bits into the internal shift register, and then send a signal the latch, which will transfer the bits to the output pins in parallel, with the output pins only getting the values that were sent to those pins.

aha for sure the 595 is the one needed but when do i use the HD74 in which application ?

firashelou: aha for sure the 595 is the one needed but when do i use the HD74 in which application ?

If the shift register is feeding into a latch register or a tri-state buffer and it doesn't matter what the outputs do before you latch the latch register or enable the tri-state buffer.

You can get an 8-bit latch and use that with your 74164 to get the functionality of a 74595.

You can use the 164 in applications where the "intermediate values" on the pins is OK; perhaps a simple LED display that only updates occasionally, or when it doesn't matter at all due to additional layers of logic (say, driving the data inputs of a parallel LCD display), or when you actually want the shift-register behavior. And the 164 has fewer pins needed to interface to the AVR.

(Although, see: http://www.edn.com/design/systems-design/4410875/One-I-O-line-drives-shift-register-with-strobe )