Shifted shift register

I've just had my first go at getting a shift register to work with my Arduino.. it was almost flawless, but I seem to be missing my first bit.

I followed the guide here, but using only one shift register: http://arduino.cc/en/Tutorial/ShiftOut

It took a little while to figure out, but it appears as though pin Q1 on my shift register is lighting up when I send the number 2, Q2 is high for 4, Q3 = 8 etc.. when I call shiftout() with the number 1 no LEDs come on.

I checked my wiring and it seems fine.. then I double checked and it's definitely fine.

The only things I can think of are: 1. My shift register is slightly different to the one they're using.. it's a 595N, not a 595. 2. I've done something wrong in the code..

In loop():

  digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, 1);
digitalWrite(latchPin, HIGH);


Does anyone have any tips on debugging this issue?

Cheers, John

• It also got me wondering what Q0 is on pin 15.. – John Hunt Mar 19 '13 at 14:42
• Q0 is the lowest order output - it's very common (though not universal) for these to be numbered from zero rather than from one. This may well explain why you are getting a different than expected result. Otherwise, you may have one too few or too many clocks. If you had written the shift function yourself, it would also be possible that you were presenting the data at the wrong time relative to the clock, but the library routine is probably OK. – Chris Stratton Mar 19 '13 at 14:56
• Upon further inspection of the Arduino tutorial my mind totally skipped over the fact they were using Q0 - the pin out layout on the circuit diagrams is slightly different from the phillips datasheet. This makes it all make sense :) – John Hunt Mar 19 '13 at 18:50