Pesky shift registers?

I started working with 2 74HC595N to control 8x8 matrix, and found that instead of a dot it activates multiple rows. So I assumed this was due to my lack of knowledge about shift registers so I setup a simple scenario from arduino ShiftOut tutorial (single register chip and 4 LEDs controlled by number via serial input i.e. "one by one sketch". Thats when I found out that shift register has almost random values on its output pins. Some LEDs were on, some off before I started to controll them. After I turned on/off all 4 it strated to work as supposed to, but last pin retained "memory" of its state even if I reset Arduino. 
So my question is, do I always need to initialize every pin of every shift register (and is there an example sketch), or do I have faulty IC?

Edit: Added schematic (it's from http://arduino.cc/en/Tutorial/ShiftOut)

ShftOut_Schm1.gif
12 answers
sort by: active | newest | oldest
Oct 4, 2012. 6:23 AMsteveastrouk says:
Pull the /MR pin low when you reset the processor, and you reset the 595. The processor reset is available on a pin of the Arduino - I can't remember if its a positive logic or negative logic, but if its positive, you need to invert it for your 595.


Make SURE /MR is HELD high after reset.
Make SURE /OE is tied LOW.

Steve

Oct 4, 2012. 7:18 AMsteveastrouk says:
ONE uF on the SHCP ? You sure ?
Steve
Oct 4, 2012. 9:42 AMsteveastrouk says:
Thats not what your circuit says
Oct 4, 2012. 6:11 AMLibahunt says:
Probably that's how shift registers act. I have experience only with 74HC164, I had a circuit with two of them and a led matrix. When microcontroller was removed from it's socket and I wiped my finger over the empty socket, then leds lit or went off because of that. And they also retained their state when nothing was happening near shift registers input pins.

To reset your shift register to one state you can simply shift out binary 00000000 or 11111111 (if it's 8 bit, or more numbers accordingly if it's something else) in arduino code setup().

Oct 4, 2012. 10:16 PMfrollard says:
to confirm;
Every time you want to write to ANYTHING in the chain, you have to write EVERYTHING in the chain...

With 2 595's, If you want to change output 4 on chip 1, you have to output 16 bits (2 bytes), because getting to that 4th bit will push everything beyond it down 4 bits...
That seems annoying, but really, you're trading speed for output pins. You could drive 16 pins from the arduino directly, and have almost none for anything else. Realistically, the tradeoff for speed is trivial, because the atmega can shift out hundreds of thousands of bits per second.
Oct 5, 2012. 1:42 AMsteveastrouk says:
Yes.
Oct 4, 2012. 5:42 AMRe-design says:
Without looking at your schematic any answer is just an educated guess more or less so take this all with a grain of salt.

I have a limited experience with shift registers but some with other digital operations.

Some things to watch for

On some chips unused input and output must be tied to a state and not left floating or they will generate unpredictable and false results

Some chips are sensitive to power supply trash and the power supplies should be bypassed with a small cap close to each chip

In most cases it's better to assume that on start up the contents of a chip will be random and will need to be reset to the state you desire as a first operation. 


Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!