I have been trying to use a shift register (74HC595) to control 8 relays. The Relays are Active Low as per the following info:
IMPORTANT NOTE: There is a issue with start-up of Arduino programs that control these relays. These relays input controls are Active LOW, meaning that setting a pin LOW turns them ON. To assure that no relays activate at Reset or Power-On until you want them to, the initialization sequence in SETUP should be:
1.digitalWrite(Relay, HIGH);
2.pinMode(Relay, OUTPUT);
So that all works fine and dandy when you're using direct pins but I'm trying to use a switch register to save pins. So the problem is when you use the shift register with it the relay goes bat-shit crazy for about a second, turning the relays on and off as fast as it can. After that though it functions perfectly normal. I have managed to reduce it a bit to just a couple on\off cycles with the following code in Setup, but its still way to much:
void setup() {
bitsToSend = 0;
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
digitalWrite(latchPin, LOW);
bitWrite(bitsToSend, 0, HIGH);
bitWrite(bitsToSend, 1, HIGH);
bitWrite(bitsToSend, 2, HIGH);
bitWrite(bitsToSend, 3, HIGH);
bitWrite(bitsToSend, 4, HIGH);
bitWrite(bitsToSend, 5, HIGH);
bitWrite(bitsToSend, 6, HIGH);
bitWrite(bitsToSend, 7, HIGH);
bitWrite(bitsToSend, 8, HIGH);
shiftOut(dataPin, clockPin, MSBFIRST, bitsToSend);
digitalWrite(latchPin, HIGH);
}
I have also been trying different combination of the Master Reset and Output Enabled Pins to see if I can force the register to HIGH on load. High impedance might also work but I'm having a hard time translating the Function Table:
Any ideas would be much appreciated!