Hey all.
I have sat up a circuit for some multiplexing test.
The circuit is almost identical to this
Except that I have two rows of 8 leds, and I have two C2120 transistors to pull them to ground.
Every 16 leds have a 280 Ohm resistor, and the power rail for the HC74595 register have a 47uF and a 1uF capacitor.
I have also added a 1uF capacitor at the latchpin as suggested in the turorial.
My arduino is hooked op to a 9V battery and I have a voltage regulator giving the circuit 5V through the V1n from the arduino.
My code is below and everything is working. BUT...
When i was going to disconnect the circuit I pulled out the battery first and then the USB, I noticed that my circuit worked without the power from the battery. I googled and found this answer:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1235359544
Anotherthing about my circuit is, if I turn the MSB on in the first row and the LSB on the second row, like this
1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1
You can se that:
1 0 0 0 0 0 0 x
x 0 0 0 0 0 0 1
The leds, where I have places the x, is turned on just a little bit. Not much, but just enough to see. I measured around 0,65V over the x Leds.
So my question is: Is my HC74595 damage because I unplug the battery first (2 -3 times) as it says it can be, in the discussion in link 2 - or is my transistors not switching fast enough or my IC not switching fast enough?
Hope all this make sense.
Thanks in advance
// Shh
My code:
//two layer
int layer0 = 2;
int layer1 = 3;
byte data0 = B11100000;
byte data1 = B00000111;
const int dataPin = 11;
const int clockPin = 12;
const int latchPin = 8;
int layerDelay = 5;
void setup()
{
pinMode(dataPin, OUTPUT);
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(layer0, OUTPUT);
pinMode(layer1, OUTPUT);
}
void loop()
{
registerWrite(data0);
digitalWrite(layer0, HIGH);
delay(layerDelay);
registerWrite(data1);
digitalWrite(layer0, LOW);
digitalWrite(layer1, HIGH);
delay(layerDelay);
digitalWrite(layer1, LOW);
}
void registerWrite(byte dataOut)
{
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, dataOut);
digitalWrite(latchPin, HIGH);
}