Speed of Shiftin command?

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,

pyrohaz:
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.

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

No.

Perfect answers!

Thanks.

You could also do this with SPI.transfer, will be a lot faster:

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);