I'm having some strange issues with shiftOut.
I am seeing my clock pin giving me a 50mS pulse and the data pin staying static on my oscilloscope.
The latchpin seems to be working ok.
What I see on my output is that whatever is on the shift register gets shifted in one second intervals until the register is all high.
I should be seeing different values shifted in.
Here is my code:
int latchPin = 0;
int clockPin = 1;
int dataPin = 2;
int lifePin = 13;
int output = 100;
//Prototypes
void writeshift(byte, byte, byte);
void setup() {
//set pins to output so you can control the shift register
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(lifePin, OUTPUT);
}
void loop() {
// pause before next value:
delay(1000);
writeOutputs(0xff,0xff, 0xff);
digitalWrite(lifePin, LOW);
delay(1000);
writeOutputs(0x00, 0x00, 0x00);
digitalWrite(lifePin, HIGH);
}
void writeOutputs(byte score1, byte score2, byte outs){
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, score1);
shiftOut(dataPin, clockPin, MSBFIRST, score2);
shiftOut(dataPin, clockPin, MSBFIRST, outs);
digitalWrite(latchPin, HIGH);
delay(1);
digitalWrite(latchPin, LOW);
}
I actually had tested it already using 1 and 2. I know they are used to program but that shouldn't and didn't interfere with the shift register outputs. I tested it using 2 registers and it worked fine. I have an extremely high pin count usage and have my other pins occupied.
I was up until 2 AM debugging and about the 5th time I checked my wires, I realized that at one of the junctions between boards, I obviously had all of the wires crossed.
I believe that a good nights sleep is in order before doing that kind of debugging.
However, I definitely had an issue with crossed wires that was causing my problem.
I don't have any decoupling caps and I saw some sporadic behavior on the scope.
I haven't been able to fix my wire crossing issues yet because I have to work during the day. but I suspect that is the primary culprit.
One of the odd things that I saw was with a volt meter, on the output QH` of the first register, when it should have been a high output, it was 8.6VDC for about a second before drifting down to 5VDC.
I have no inductance (unless it is parasitic) and no voltage above 5vdc in the system so this confuses me.
it was 8.6VDC for about a second before drifting down to 5VDC.
Not good.
As well as inductance you can get this effect with capacitors. If you have a capacitor in series between an output at zero and a logic input at +5V. Then when the output goes to +5V the logic input will go up to +10V before it starts to discharge. It is likely that you would see this as an 8.6V spike on a scope.