i set up my 74HC595 shift register on a bread board just like this but it dosent seem to be working
on further note when i plug in the 5v wire to where the ground line for the leds should be they light up strangely and otherwise not at all

i set up my 74HC595 shift register on a bread board just like this but it dosent seem to be working
on further note when i plug in the 5v wire to where the ground line for the leds should be they light up strangely and otherwise not at all

What LEDs? Please post your code. It is difficult to help with code that we can't see. Please read the "how to use the forum" stickies to see how to properly format and post code.
//Pin connected to latch pin (ST_CP) of 74HC595
const int latchPin = 8;
//Pin connected to clock pin (SH_CP) of 74HC595
const int clockPin = 12;
////Pin connected to Data in (DS) of 74HC595
const int dataPin = 11;
void setup() {
//set pins to output because they are addressed in the main loop
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
Serial.begin(9600);
Serial.println("reset");
}
void loop() {
if (Serial.available() > 0) {
// ASCII '0' through '9' characters are
// represented by the values 48 through 57.
// so if the user types a number from 0 through 9 in ASCII,
// you can subtract 48 to get the actual value:
int bitToSet = Serial.read() - 48;
// write to the shift register with the correct bit set high:
registerWrite(bitToSet, HIGH);
}
}
// This method sends bits to the shift register:
void registerWrite(int whichPin, int whichState) {
// the bits you want to send
byte bitsToSend = 0;
// turn off the output so the pins don't light up
// while you're shifting bits:
digitalWrite(latchPin, LOW);
// turn on the next highest bit in bitsToSend:
bitWrite(bitsToSend, whichPin, whichState);
// shift the bits out:
shiftOut(dataPin, clockPin, MSBFIRST, bitsToSend);
// turn on the output so the LEDs can light up:
digitalWrite(latchPin, HIGH);
[code]
when i switch the 5v for ground i switch the leds around too
I wired up a 74HC595 to my Uno and some LEDs. Loaded and ran your code and the code works without modification (except cleaning up the end where it got posted funny). I had to set the line endings in the serial monitor to none to prevent the sending of the carriage return/line feed into the serial buffer. If they are there they are interpreted as numbers (which become negative when 48 is subtracted) and shifted out (bad). Type 1 and enter and the second (since they are numbered from 0) LED lights, type 5 and the 6th lights.
So it's not the code. Double check wiring and polarities. Make sure oe* is grounded and MR* is at Vcc. And if there is really a cap on the latch input of the 595 remove it.
tytywithasword:
i set up my 74HC595 shift register on a bread board just like this...
That's the Fritzing picture from the shiftout() page on this site.
It has a long-standing error that nobody seems to be able to correct.
The 1uF capacitor on the latch line is WRONG. It should be removed.
That cap (or a 100n cap) should go from the chip's VCC pin to ground, not from the latch pin to ground.
Leo..
tytywithasword:
i set up my 74HC595 shift register on a bread board just like this but it dosent seem to be working
on further note when i plug in the 5v wire to where the ground line for the leds should be they light up strangely and otherwise not at all
Why would you plug in a 5 volt wire to where a 'ground' line should be?