4 bit vs 8 bit shift register help ?

hello guys,
can i have a simple explanation about the difference between a 4 bit and an 8 bit shift register please ? and can both be used for the same applications ?

If you put 8 pencils in a row, you have 8 pencils in a row. If you shift the row to the left, all 8 pencils shift to the left.
If you put 4 pencils in a row, you have 4 pencils in a row. If you shift them, all 4 are shifted.

The Arduino Uno uses the ATmega328p microcontroller. That is an 8-bit microcontroller. So when it shifts data, it shifts with 8 bits.

The 74HC595 and 74HC195 are often used to shift out or shift in data with the Arduino. They are 8-bits.

What kind of device/chip/ic are you talking about ?

Erdin:
If you put 8 pencils in a row, you have 8 pencils in a row. If you shift the row to the left, all 8 pencils shift to the left.
If you put 4 pencils in a row, you have 4 pencils in a row. If you shift them, all 4 are shifted.

The Arduino Uno uses the ATmega328p microcontroller. That is an 8-bit microcontroller. So when it shifts data, it shifts with 8 bits.

The 74HC595 and 74HC195 are often used to shift out or shift in data with the Arduino. They are 8-bits.

What kind of device/chip/ic are you talking about ?

it's a CD4015BE DIP-16

so you mean i can just lights up 4 LEDs ?

That part is two separate 4bit shift registers. Individually each can only shift 4 bits / light 4 LEDs as you say.

But, you can chain them together. Connect the two clock pins together, connect the two reset pins together. Then connect Q4A (the last bit of the first register) to DataB (the data input of the second). Now you have a single 8bit shift register which can light 8 LEDs.

The CD4015 output current is in the range of 1mA. That is not enough for a led. The led will glow, and it might work, but please avoid it.

aha ok that's good and about a shift register that has the same structure as the 595 but without the OE that shift is 594 so you think it probably is the same as 595 ?

Unfortunately the shift registers have slightly different behaviour.

The CD4015 shifts all data on its outputs along with a rising edge clock pulse. This means if you want to change all outputs you have to shift 8 times, but you get 7 intermediate states, e.g:

Consider the data on the shift register is currently 10101010, but you want it to be 11110000
Your shift looks like this:

(start) 10101010
(step1) 01010101
(step2) 00101010
(step3) 00010101
(step4) 00001010
(step5) 10000101
(step6) 11000010
(step7) 11100001
(step8) 11110000

The 74HC595 on the other hand has an additional output latch which is clocked separately. This means that the outputs will stay the same while you are shifting in new data, and then change to your new data when you clock the output buffers. You then get no intermediate states.
Lets do the same example as above, but with a 595:

         ShiftReg       Output
(start) 10101010      10101010
(step1) 01010101      10101010 <-data remains the same
(step2) 00101010      10101010 <-...
(step3) 00010101      10101010 <-...
(step4) 00001010      10101010 <-...until
(step5) 10000101      10101010 <-...
(step6) 11000010      10101010 <-...
(step7) 11100001      10101010 <-...
(step8) 11110000      11110000 <-you latch output register here

Whether this is a problem depends on your application.

But also as Erdin mentioned they two are different electrically. The CD4015 can only drive a ~5mA load. This might just be enough for an LED, but it will be quite dim - depends on the LED of course.
You can solve both those issues by using an external 8bit latch/buffer to increase the drive strength but also prevent the intermediate states. However in this setup you need two chips rather than just the one.

firashelou:
hello guys,
can i have a simple explanation about the difference between a 4 bit and an 8 bit shift register please ?

The clue is in the name. One of them has 4 of whatever it is, the other has 8.

firashelou:
and can both be used for the same applications ?

No. You could use an 8 bit shift register when you have 4 things (there'll be 4 unused) but you can't use the 4 bit shift register when you need 8 things.

ok so i found out that the only shift register that is available in the shop is this : SN74HC594
which is an IC that doesnt have a OE, so doesn't it make any difference if i want to use it like the SN74HC595 ?

firashelou:
ok so i found out that the only shift register that is available in the shop is this : SN74HC594
which is an IC that doesnt have a OE, so doesn't it make any difference if i want to use it like the SN74HC595 ?

That depends on what you want to use it for ... but really a 595 is much better for what you want.
a) The SN74HC594 could cause flicker with LEDs.
b) If you're a newbie, there's a million web pages (approx) that tell you how to use a SN74HC595 with an Arduino. Google for "SN74HC594 arduino" came up with one useful page, and it was only half useful (I wouldn't be able to connect a 594 using only that page).

My advice: Try a bit harder to find a 595. They're very common chips.

fungus:

firashelou:
ok so i found out that the only shift register that is available in the shop is this : SN74HC594
which is an IC that doesnt have a OE, so doesn't it make any difference if i want to use it like the SN74HC595 ?

That depends on what you want to use it for ... but really a 595 is much better for what you want.
a) The SN74HC594 could cause flicker with LEDs.
b) If you're a newbie, there's a million web pages (approx) that tell you how to use a SN74HC595 with an Arduino. Google for "SN74HC594 arduino" came up with one useful page, and it was only half useful (I wouldn't be able to connect a 594 using only that page).

My advice: Try a bit harder to find a 595. They're very common chips.

i did tried a lot :frowning: and that made me frustrated !!
the only one i could find is the 594 that is closer to 595, but the difference is the OE which is not the latch !! so that would cause a flicker !!?
my application is i want to make LEDs that act like an RPM LEDs you know like the one seaters one !! one after the other untill it reach the end and then when u click a button it should all go off and then start again depending on the value of the Pot

I think the 594 and 595 are close enough that you won't have any problems.

which is an IC that doesnt have a OE,

Why do you want one are you going to do anything that needs a ti state output?

so doesn't it make any difference if i want to use it like the SN74HC595

Look at the data sheets. They are very similar but not identical.

but the difference is the OE which is not the latch !!

You are not understanding. OE is output enable, it is nothing to do with a latch, the latch is separate.

Grumpy_Mike:

which is an IC that doesnt have a OE,

Why do you want one are you going to do anything that needs a ti state output?

so doesn't it make any difference if i want to use it like the SN74HC595

Look at the data sheets. They are very similar but not identical.

but the difference is the OE which is not the latch !!

You are not understanding. OE is output enable, it is nothing to do with a latch, the latch is separate.

yes it's not a latch, so what is the difference between these 2 ICs can use the 94 for same app as the 95 i mean controlling the LEDs the way i want without any problems ?

firashelou:
i did tried a lot :frowning: and that made me frustrated !!

You might have to buy online. eBay is easy...

(solving this problem is important because you'll eventually need other stuff as well)

firashelou:
the only one i could find is the 594 that is closer to 595, but the difference is the OE which is not the latch !! so that would cause a flicker !!?

You don't need OE, you do need the latch. Lack of latch is what can cause flicker because the LEDs aren't updated in a single cycle.

A 594 can work but it will need different programming than on all the web pages out there.

I think they're just different enough to cause problems.

so what is the difference between these 2 ICs

One has a tristate output and the other does not.

Please look at the data sheets for the two devices.

i am looking but the thing is i can't understand everything but i would love to learn how to understand the whole thing or most of it .
thank you guys will see what i can do about it

All the data sheets are written in a different style. Look at the same maker for the two data sheets. The NXP has a pin description in section 6.
Look at the pin number changes.
On the 594 you do not need the SHR and the STR so wire them high.
SHCP is the clock signal
STCP is the latch signal

fungus:
I think they're just different enough to cause problems.

The only difference is one has a tristate buffer. If the OE enable pin is not needed, which it isn't, then the two are identical. Both have an output latch. Both have the same structure if you look at the datasheet:

Fig 4. page 3 : http://www.nxp.com/documents/data_sheet/74HC_HCT595.pdf
Fig 4. page 3 : http://www.nxp.com/documents/data_sheet/74HC_HCT594.pdf

Sure some pins have different names, but they have the same function:

74HC595:

DS = Data In
SHCP = Shift Clock In
!MR = Tie to VDD
STCP = Latch Data
!OE = Tie to VSS
Q0-Q7 = 8 outputs.

74HC594:

DS = Data In
SHCP = Shift Clock In
!SHR = Tie to VDD
STCP = Latch Data
!STR = Tie to VDD
Q0-Q7 = 8 outputs.

In that setup, where is the difference? They will not cause any flickering as both have an additional output register.