Hi guys, I am a newbie developing a for-fun system that can monitor >100 sensors. Right now I'm using multiple 74HC165N/74LS165N SHIFT registers daisy-chained to increase the input ports for my Arduino Mega.
- Question 1
While studying the tutorial from these 2 sources:
http://playground.arduino.cc/Code/ShiftRegSN74HC165N
I notice both of them include delay during latching and clocking:
#define PULSE_WIDTH_USEC 5
digitalWrite(clockEnablePin, HIGH);
digitalWrite(ploadPin, LOW);
delayMicroseconds(PULSE_WIDTH_USEC);
digitalWrite(ploadPin, HIGH);
digitalWrite(clockEnablePin, LOW);
digitalWrite(clockPin, HIGH);
delayMicroseconds(PULSE_WIDTH_USEC);
digitalWrite(clockPin, LOW);
which is essentially asking the microprocessor to wait 5us before going to next instruction.
However, from the SHIFT register data sheet most of the instructions only require 10-45ns
This got me thinking since Uno and Mega are 16Mhz clock which is 62.5ns per cycle, am I right to say that there is no need to include delays since the microprocessor is "slow enough" for stable latching and clocking for the SHIFT register.
- Question 2
Is it possible to daisy-chain 13 SHIFT registers so I can have ~100 inputs? Right now I have no problem with 5 of them chained together using unsigned long long
for my values datatype since it is 64-bit. I wonder if there is a better method or datatype that can store >100 bits of information if I increase my inputs to beyond 100.
Thank you so much for your time.