Pages: [1]   Go Down
Author Topic: Which shift register to get  (Read 847 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Noob question on parts.

I am working on a project, and I want to add more inputs using shiftIn().  The example on the arduino site uses the CD4021B shift register. 

My dumb question is: do I need to have the CD4021B or are there other chips that will work in a similar fashion.  I am going to be in Frys Electronics in Phoenix tomorrow, and I would like to pick some up, but I am not sure I will be able to find that exact chip.  If I find a shift register with 4021 then name, is that basically the same thing?

I already have some 74HC595's for shiftOut(), but I am thinking that they only work for output.  Is that correct?

Thanks,
Rob
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27089
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.ti.com/lit/ds/snos323a/snos323a.pdf
Pretty standard parallel load, serial out shift register.

'595, serial in, parallel out, correct.

Part like '374, octal latch, can also be wired as a shift register.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6614
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What will be connected to the inputs of your shift register? You may be able to avoid the need for a shift register by multiplexing. Alternatively, using an Arduino Mega might be the best option, if it saves using a pile of external hardware.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It will only be used for momentary switches (need at least 14).  At this point I believe that only one will be pressed at a time, so I think multiplexing could also work.  Would the 4051 chip be the right one to use for this?

Either way I go, I want to buy hardware tomorrow.

Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 626
Posts: 34168
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Would the 4051 chip be the right one to use for this?
No do not use these chips for outputs.
While changing the select lines because you don't do the change simultaneously (and even if you did) there are intermittent states that can give you false spikes on unintended outputs.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6614
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If no more than 2 push buttons will be pressed at a time, the you can multiplex up to 16 of them in a 4x4 matrix with no extra hardware, if you can spare 8 pins. See the keypad tutorial and driver for how to do this. If more than 2 may be pressed at a time, you can still multiplex them, but you need a diode in series with each switch. This is still simpler than the shift register solution, since with shift registers you would also need one pullup or pulldown resistor per button.

If you are multiplexing any other devices - even output devices such as 7 segment displays - then you can share the 4 column outputs with those other devices. The main benefit of using shift registers is that you can read all the switches using only 3 pins.
« Last Edit: April 14, 2012, 05:12:54 am by dc42 » Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 5578
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I am going to be in Frys Electronics in Phoenix tomorrow, and I would like to pick some up, but I am not sure I will be able to find that exact chip

I live near the Fry's on Thunderbird. If you've never shopped Fry's for electronic components, get ready for some fun. They are a distributor for NTE Electronics (http://www.nteinc.com/); some of the their parts are "standard numbered", but most have an "NTE number". Your best bet is to find the NTE parts catalog somewhere on the shelf, thumb through it to find the part, then find that part on the shelf/pegs. Fry's doesn't carry all of the parts that NTE supplies, so you may find something perfect in the catalog, but it won't be on the shelf. Fair warning.

What I typically do to find components is shop online - Digikey and Mouser (and a couple other places) if I need "new stock" items. If I can go with surplus, but I need it fairly soon, I'll use Electronic Goldmine (in Scottsdale, web only though); otherwise if I can wait a bit longer (sometimes the difference is minimal) I'll use All Electronics. Just about every weekend I'll go down to Apache Reclamation and Electronics in south Phoenix to check out what they have (if you don't know about this place, you owe it to yourself to check it out). Beyond that, it's Ebay and chinese suppliers.

Good luck finding your parts. smiley
Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the locations cr0sh.  I live down in Casa Grande, so the Frys on baseline is the closest to me (about an hour away).  Ended up staying home over the weekend, so I just ordered the parts online.

Thanks for the help,
Rob
Logged

0
Offline Offline
Shannon Member
****
Karma: 206
Posts: 12179
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Unless you have a special reason to use the CD4000 series ICs, I would strongly suggest the 74HC series with superior performance, cheaper, will be around into the future for longer.

Some shift registers have a separate output latch (this can be a vital requirement in some situations) and some don't.  Some do serial to parallel, some parallel to serial and some do both.  Some can shift in either direction.  Check your requirements...
Logged

[ I won't respond to messages, use the forum please ]

Pages: [1]   Go Up
Jump to: