Pages: [1]   Go Down
Author Topic: Speed of Shiftin command?  (Read 454 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey guys,

I was just wondering at how long it takes for shiftin to complete one cycle (as in one cycle being the command reading in one byte). I have 20 inputs, therefore needing 3 4021 chips (8*3 > 20).

Realistically, I could do with the shiftin being <10ms so that I can call a shiftin every 10ms.

Also, while shiftin is happening, is the arduino able to do other things?

Cheers,
Logged

Valencia, Spain
Online Online
Faraday Member
**
Karma: 144
Posts: 5338
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey guys,

I was just wondering at how long it takes for shiftin to complete one cycle (as in one cycle being the command reading in one byte). I have 20 inputs, therefore needing 3 4021 chips (8*3 > 20).

Realistically, I could do with the shiftin being <10ms so that I can call a shiftin every 10ms.

No problem. It's probably hundreds of times faster than that.

Also, while shiftin is happening, is the arduino able to do other things?

No.
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

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

Perfect answers!

Thanks.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26442
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

You could also do this with SPI.transfer, will be a lot faster:
Code:
digitalWrite(ssPin, LOW);  // if you need CS with the part you are using.  can also direct port manipulation for more speed
incomingByte = SPI.transfer(0); // where 0 is data that will get clocked out on MOSI pin while data is clocked in on MISO pin at the same time.
digitalWrite(ssPin, HIGH);
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.

Pages: [1]   Go Up
Jump to: