Go Down

Topic: Maximum current for 74HC595 (Read 4 times) previous topic - next topic

Ron C

I am wondering about the current limits of the 74HC595 8-bit shift register. Reading the datasheet is confusing -
it seems that 70mA is the maximun current for the chip. If one LED is drawing around 20mA, the chip can only handle 3 LEDS even though there are 8 pins...

http://focus.ti.com/lit/ds/symlink/sn74hc595.pdf

Supply voltage range, VCC . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [ch8722]0.5 V to 7 V
Input clamp current, IIK (VI < 0 or VI > VCC) (see Note 1) . .  . . . . . . . . . . . . . . . . . . . . . . . . . . . ±20 mA
Output clamp current, IOK (VO < 0 or VO > VCC) (see Note 1) . . . . . . . . . . . . . . . . . . . . . . . . . . . ±20 mA
Continuous output current, IO (VO = 0 to VCC) . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . ±35 mA
Continuous current through VCC or GND. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ±70 mA
NOTES: 1. The input and output voltage ratings may be exceeded if the input and output current ratings are observed.

Mike Perks

The humble 74HC595 is not really made for driving LEDs. In fact the datasheet recommends 6mA per output.

You need a high-current 595 driver chip such as the TI TPIC6C595.

Quote

The TPIC6C595 is a monolithic, medium-voltage, low-current power 8-bit shift register designed for use in systems that require relatively moderate load power such as LEDs.

Continuous source-to-drain diode anode current . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .  . . . . . . 250 mA
Pulsed source-to-drain diode anode current (see Note 3) . . . . . . . . . . . . . . . . . . . . . . . . . . . .   . . . . . 500 mA
Pulsed drain current, each output, all outputs on, ID, TC = 25°C (see Note 3) . . . . . . . . . . . . . . . . . . . 250 mA
Continuous drain current, each output, all outputs on, ID, TC = 25°C . . . . . . . . . . . . . . . . . . . . . . . . . 100 mA
Peak drain current single output, IDM,TC = 25°C (see Note 3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 mA
Mike Perks
oakmicros.com
See our om328p Arduino Compatible

Ron C

#2
Jul 26, 2009, 03:51 am Last Edit: Jul 26, 2009, 04:21 am by ronczap Reason: 1
Mike,
  Thanks! I recall seeing other posts about the TPIC6C595 but didn't realize the big difference in capability.

Looks like the TPIC6595 handles more current than the TPIC6[size=12]C[/size]595

I may order some to experiment with.

Thanks again...

jabstarr

#3
Jan 11, 2010, 03:45 pm Last Edit: Jan 11, 2010, 03:47 pm by jabstarr Reason: 1
hm.... im confused!
if the 74HC595 is not really meant for driving LEDs what are all the LED shiftOut tutorials for the 74HC595 doing out there?
say http://www.arduino.cc/en/Tutorial/ShiftOut --- isn't this just plain wrong then?  :o
when will it all fry?

i've done a basic 32 LED project, and the 4 shift registers i'm using are acting funny.... so i'm wondering if they might be burned?

my wiring is like: http://www.arduino.cc/en/Tutorial/ShiftOut -- only with 4 shift registers in stead of 2

and here is my code:

Code: [Select]
/*
 4 shift register, skips one bit??
*/

// setup up shift register
int clockPin = 12;
int latchPin = 8;
int dataPin = 11;

int ledPin = 13;
boolean ledState = HIGH;

long lastUpdate = millis();
long lastShift = millis();

int registers = 4;
// a byte keeps 8 bits, one byte pr shift register
byte data[] = {0,0,0,0};
int count = 0;

void setup()   {                
 pinMode(clockPin, OUTPUT);
 pinMode(latchPin, OUTPUT);
 pinMode(dataPin, OUTPUT);
 
 compileBytes();
 blinkAll(1000);
}

void loop()                    
{
 if (millis() > lastShift+500) {
   shiftRight();
   lastShift = millis();
 }  
 sendData();
}

void shiftRight() {
 count = count+1 ;
 if (count==8*registers) count = 0; //wrap around
 compileBytes();
 printStatus();
}

void compileBytes () {
 //blink LED
 ledState = !ledState;
 digitalWrite (ledPin, ledState);
 
 //compile bytes
 for (int i = 0;i<registers; i++) {
   for (int j = 0; j<8; j++) {
     if (count == i*8+j) {
       bitWrite(data[i], j, HIGH);
     } else {
       bitWrite(data[i], j, LOW);
     }
   }
 }
}

void sendData() {
 //write data
 digitalWrite(latchPin, 0);
 for (int i = 0;i<registers; i++) {
   shiftOut(dataPin, clockPin, LSBFIRST, data[i]);
 }
 digitalWrite(latchPin, 1);
}

void printStatus() {
 Serial.print("count: ");
 Serial.println(count);
 
 for (int i = 0;i<registers; i++) {
   for (int j = 0; j<8; j++) {
     if (bitRead(data[i], j)) {
       Serial.print("1");
     } else {
       Serial.print("0");
     };
   }
   Serial.print(" ");
 }
 Serial.println();
}

void blinkAll(int d) {
 digitalWrite(latchPin, 0);
 for (int i = 0;i<registers; i++) {
   shiftOut(dataPin, clockPin, LSBFIRST, 255);
 }
 digitalWrite(latchPin, 1);
 delay(d);
 digitalWrite(latchPin, 0);
 for (int i = 0;i<registers; i++) {
   shiftOut(dataPin, clockPin, LSBFIRST, 0);
 }
 digitalWrite(latchPin, 1);
 delay(d);
}
 


the sequence they go through is like this:

blinkAll():
all on: 11111110
all off: 00000000

loop():
1: 00000010
2: 00000100
3: 00001000
4: 00010000
5: 00100000
6: 01000000
7: 00000000
8: 10000000

--- so the 8th LED nevers lights up (on all 4 shift registers), and in the loop the shift registers basically skip step 1, and adding a blank step on step 7

my code seems to be right. if you turn on the serial monitor, you can see a printout of the 4 bytes sent to the registers... it all seems ok...

what am i doing wrong here?

/j

Grumpy_Mike

If you have 4 shift registers then you need some supply decoupling on each of the chips:-
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

With a 220R resistor you will be pulling about 18mA from each pin. That is somewhat overstress things. However, these outputs sag a bit when you start taking current from them so if you measured it you would probably find you are not outputting 5V but more like 3.3V to them. This cuts down the current and makes it a lot safer.

jabstarr

ah, ok, i see. thanks a lot for the link and the article. nicely written, very practical approach to the world of noise/analogue electronics, which is normally very unaccessible to us electro-laymen

one question though:
when looking at the arduino shift out tutorial again, i see that they have a noise cancelling capacitor, between the latch pin and ground (see pic) --- not between ground and 5V.... is this essentially doing the same thing? also why not between data pin and ground? i would suppose there is most data traffic (and noise?) on this pin?



well... i will give it a shot, with capacitors. decoupling mode. and let you know how it turns out.

cheers,
j

Grumpy_Mike

Quote
i see that they have a noise cancelling capacitor, between the latch pin and ground


Yes and I wish the hadn't. That is a piece of very bad design. It is a kluge and being a tutorial has mislead many beginners.

It essentially cuts out noise on the latch line but if you write the software correctly in the first place, or build it correctly you don't need it.

There should be a capacitor across the supply, if you have one then maybe you don't need it in the latch.

The author had a problem and rather than fix it he found something that worked "for him". This is not the same as fixing it. He has no adequate explanation for how or why it is needed.

Sorry about the rant but don't believe all you read on the net.
(That by definition includes me  ;)  )

jabstarr

ok, i got it working now  :D
i added a 100nF capacitor between 5V and ground on all 4 shift registers and now they are blinking happily. correctly.
thanks for the help!
best,
/j

Go Up