74HC595 Data Output?

Hey Guys,
I'm creating a project which has seven separate Texas Instruments 74HC595 Shift Registers daisy chained. In addition, I have ten 7-segment displays connected to those shift registers. I would include a diagram, but there is SO much wiring to it. I have checked the wiring and everything seems to be working correctly.

I have searched google up and down, and I haven't been able to get a straight answer. How would you go about sending data in binary to the shift registers (in this case my setup is 56 Bits). I need to be able to control each pin separately. I created a test sketch:

//Pin connected to ST_CP of 74HC595
int latchPin = 11;
//Pin connected to SH_CP of 74HC595
int clockPin = 10;
////Pin connected to DS of 74HC595
int dataPin = 12;

void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(latchPin, OUTPUT);
  
  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, MSBFIRST, B00000000);
  shiftOut(dataPin, clockPin, MSBFIRST, B00000000);
  shiftOut(dataPin, clockPin, MSBFIRST, B00000000);
  shiftOut(dataPin, clockPin, MSBFIRST, B00000000);
  shiftOut(dataPin, clockPin, MSBFIRST, B00000000);
  shiftOut(dataPin, clockPin, MSBFIRST, B00000000);
  shiftOut(dataPin, clockPin, MSBFIRST, B00000000);
  digitalWrite(latchPin, 1);
}

void loop() {
  
}

This should light up all of the segments of the 7-segment displays, however it is only lighting up the first 6 or so. And I can only get it that far after resetting it ten times.

Any help is greatly appreciated, and thanks in advance!

Hakan Saplakoglu

The first design problem I would pick with this, is the inappropriate use of 74HC595s as display drivers.

You should be using two MAX7219s to drive five displays each.

If you must persist in your present perverse plan, then there is clearly a problem with your wiring, perhaps the layout, perhaps lack of bypass capacitors, wires too long, something. But given that you have only partially described the arrangement you are using, we could not really know, could we?

Hakan, 7 shift registers = 56 outputs
10 7-segment displays = 70 segments, so there seems to be a mismatch there unless not all segments are driven.
Do you have current limit resistors on each HC595 output? If not, you are likely overdriving the 595 outputs, or the segments, you'll which when one or the other fails.
Are the displays common anode or common cathode? Are smaller displays capable of being driven from 5V?
Two MAX7219 would have made your life a lot easier. No current limit resistors needed, just a resistor and two caps per MAX7219.
Can you post a drawing of 1 shift register and 1 display at least?

To answer your question, some of the anodes in my project will never be used, that’s why I have room to fit it all into seven shift registers. I was not aware of the MAX7219, so I will look into that.

The 7-segment displays have common anodes.

However, for the time being, I would like to secure my knowledge on shift registers for future projects. I will attach a diagram of my setup. I double checked, and triple checked the wire layout. The sketch I am currently working with should change the active anode every second, however only one anode lights up, and never changes.

//Pin connected to ST_CP of 74HC595
int latchPin = 11;
//Pin connected to SH_CP of 74HC595
int clockPin = 10;
////Pin connected to DS of 74HC595
int dataPin = 12;


void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(latchPin, OUTPUT);
}

void loop() {
  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, MSBFIRST, B01111111);
  digitalWrite(latchPin, 1);
  delay(1000);
  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, MSBFIRST, B10111111);
  digitalWrite(latchPin, 1);
  delay(1000);
  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, MSBFIRST, B11011111);
  digitalWrite(latchPin, 1);
  delay(1000);
  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, MSBFIRST, B11101111);
  digitalWrite(latchPin, 1);
  delay(1000);
  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, MSBFIRST, B11110111);
  digitalWrite(latchPin, 1);
  delay(1000);
  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, MSBFIRST, B11111011);
  digitalWrite(latchPin, 1);
  delay(1000);
  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, MSBFIRST, B11111101);
  digitalWrite(latchPin, 1);
  delay(1000);
  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, MSBFIRST, B11111110);
  digitalWrite(latchPin, 1);
  delay(1000);
}

I will attach a diagram of my current test setup (I’m trying to get it to work with only shift register and one 7-segment display, with no luck)

3c3756e0be8210d5a8cb725d9844c3a53a3816a0.png

Why aren’t you setting all three pins as outputs?

You need a resistor for each segment (cathode), not one in the common.

You clearly need the MAX7219s. Just in case you get confused by things you might read in less-than-reliable sources, there is no reason whatsoever that they cannot be used with common anode displays.

The first design problem I would pick with this, is the inappropriate use of 74HC595s as display drivers.

74HC595s are perfectly OK as display drivers. I have done this on two boards since 2001.
On these days, LEDs are very efficient, 2mA can make a Hi-Efficiency LED fairly bright.

You should be using two MAX7219s to drive five displays each.

With all due respect, I disagree. I will not use the MAX7219 for a display driver, because it’s ridiculously expensive. 2 MAX7219s cost $18. 30 years ago, that price was acceptable when the IBM PC/XT without a HD sold for $1600. Today, I guess that it’s only been used in legendary products or expensive medical equipment selling for $1000 or more. I won’t even use it in a prototype. Software for the HC595 is not difficult to write.

I would use one HC595 to buffer segments and another HC595 to drive digits, so I can multiplex up to 8 digits. If the display is not bright enough, I can do:

  1. Use Hi-Efficiency LEDs or
  2. Use a TPIC6C595N as digit drivers, it can provide 100mA on each output.
    The digi-key’s one piece price is $0.58, $1.15 and $9.13 for the HC595N, TPIC6C595N and MAX7219, respectively,
    http://www.digikey.com/product-detail/en/SN74HC595N/296-1600-5-ND/277246
    http://www.digikey.com/product-detail/en/TPIC6C595N/296-2020-5-ND/276260?WT.srch=1
    http://www.digikey.com/product-detail/en/MAX7219CNG%2B/MAX7219CNG%2B-ND/948191

I shamelessly show you two of my boards that use the HC595s as display drivers:

  1. A 68HC11 EVB in 2001, I used two HC595s to multiplex 4 digits
    Wytec Evaluation Boards: EVBplus

Roger Schaefer made a higher resolution picture for showing the HC595 part number, you can see it on his web site:
http://www.rasmicro.com/DS1307.htm

  1. The new EduBase board for the Tiva Launchpad.
    EVBPlus Tiva Launchpad Base Board

Attached is the schematic of using two HC595s to control four 7-seg displays. It’s been proven to work and low cost.

HC595_display_driver.pdf (67.1 KB)

Hmm... I use this one for tasks like that. ebay-deal
They can be chained for more digits..

MAX7219 are only $3 nowadays.

Good deal vs 8 discrete shift registers at 50 cents each or similar plus caps and current limit resistors and space.
Need extra code to use with common anode vs common cathode.

I think the code is the issue. You have all the shift registers daisychained?
Then

digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, MSBFIRST, B01111111);  // Get rid of one of these as you only have 7 shift registers.
  shiftOut(dataPin, clockPin, MSBFIRST, B10111111);
  shiftOut(dataPin, clockPin, MSBFIRST, B11011111);
  shiftOut(dataPin, clockPin, MSBFIRST, B11101111);
  shiftOut(dataPin, clockPin, MSBFIRST, B11110111);
  shiftOut(dataPin, clockPin, MSBFIRST, B11111011);
  shiftOut(dataPin, clockPin, MSBFIRST, B11111101);
  shiftOut(dataPin, clockPin, MSBFIRST, B11111110);
  digitalWrite(latchPin, 1); // all outputs update on this rising edge

Repeat that sequence if you have different patterns.
Or pull the data from an array and put the shiftOuts in a for loop.

digitalWrite(latchPin, 0);
for (x=0; x<7; x=x+1){
  shiftOut(dataPin, clockPin, MSBFIRST, dataArray[x]);  
}
  digitalWrite(latchPin, 1); // all outputs update on this rising edge

actually 50 cents ea from reliable sources: http://www.ebay.com/itm/10PCS-IC-MAX7219CNG-MAX7219-DIP-24-DRIVER-LED-DISPLAY-8DGT-NEW-GOOD-QUALITY-/121855485518?hash=item1c5f27264e:g:R-UAAOSwX~dWiK7j. as low as 20-30 cents higher qty or from alibaba dealers and as knut shows not much more than a dollar for one with 8 digit leds attached.

i want to thank the guys here again for opening my eyes to the common anode trick. 595 BEGONE!

that said the 595 does work and are very cheap too. we are talking only pennies difference per digit. 7219 are just easier. you dont really need any resistors at all with either using proper multiplexing. in any case proof there IS life after lcd.

btw as mentioned 595 works by shifting in all the data then enabling all of them via that pin. not really a two pin device like some assume. that is probably where the hardware or software bug lies.

ebay is not a reliable source. there is no traceability back to any manufacturer.

by reliable i meant every time an item is needed it was available and dependable for majority of applications. some of my clients do require "traceability" and willing to pay for that but the other 99.9% are fine with global sourcing. few here (or anywhere for that matter) are involved with ballistic missiles, military gear, medical, or the like so whatever works.

economy, performance, and availability are my priorities. specially for hobby use but also most commercial. we have discussed this before and i can understand why there might be other requirements.

knut_ny:
Hmm... I use this one for tasks like that. ebay-deal They can be chained for more digits.

Well, this one is a teeny bit cheaper, and we seem to have found this dealer reliable. They do cost somewhat more with the displays mounted on socket pins.

The point is that one module can show three separate two-digit numbers (and you can make an "=" between if you like) or two separate three-digit numbers, or a four and a three (or two) and so on, and for these prices, you just buy as many as needed and happily "waste" some digits.

We should not use eBay pricing on a BOM. Is DigiKey too greedy? I don't think so, if Mouser sells it at a much lower price, DigiKey will lose market share. The price mainly is dictated by Maxim.

actually 50 cents ea from reliable sources

Buy one from DigiKey or Mouser for $9, then buy one from eBay for $0.50 that doesn't even bother to copy the Maxim's logo.
If you put them side by side and compare the markings under a microscope, you will know the reason of the price difference.

If you make a new product with a potential, you better off with HC595, or TPIC6C595N than MAX7219 in the long term. One day when your product takes off, would you like to deal with eBay sellers or DigiKey and Mouser? BTW, The D-M's price in 1000 pcs is only $0.1, $0.52 for HC595 and TPIC6C595N, respectively.

Globe sourcing, traceability and reliable dealers are all good, but it means nothing if you don't get the real thing. To the end, I need to know who made the chip. I don't think that Maxim made the $0.50 chip to be put into the 8-digit module. One possibility is that someone went bankrupt, so he had to liquidate everything for nothing, but the chance is slim.

btw as mentioned 595 works by shifting in all the data then enabling all of them via that pin. not really a two pin device like some assume. that is probably where the hardware or software bug lies.

Yes or no, it depends on your circuitry, if you already have SPI signals available to interface other parts, like a SD card, you get them for free and only need one pin, not two pins, to latch data out in parallel.

make an "=" between if you like

Nothing is perfect. If you turn an individual display upside down, 2 central decimal points can be used as a colon when implementing a clock display, you can't do it on an 8-digit module.
See how the clock colon looks: rasmicro.com is for sale | HugeDomains

firebirduino:
Buy one from DigiKey or Mouser for $9, then buy one from eBay for $0.50 that doesn't even bother to copy the Maxim's logo.

maxim logo is not worth $8.50 to me. i agree there are some situations where it is, even among my own customers, but rare.

imo there are two types: "more money than brains crowd" and "penny wise pound foolish gang". i am more towards the latter having been known to burn $1 in gas to save 10 cents on bunch of bananas across town.

maxim logo is not worth $8.50 to me.

The logo is worth nothing to me if both chips are made by Maxim. Since the logo will not do anything in my circuitry, I will buy one without logo if it's only $0.01 cheaper, I am that cheap. If the $0.50 chip is not made by Maxim, the logo is worth exact $8.50 on a Maxim chip.

I think that the $0.50 chip is not made by Maxim, that's my personal guess with many years of working experience in the field, it does not mean all $0.50 chips are definitely not made by Maxim, you can tell when checking them under a microscope.

"more money than brains crowd"

Generous people paid $9 may not be "more money than brains crowd", some of them are big companies' decision makers and way smarter than us. They stood on principle.

This is not the Maxim forum, I am just wondering if someone recommends the $0.50 chip on Maxim forum, what will be the reaction over there?

firebirduino:
some of them are big companies' decision makers and way smarter than us.

In terms of making money, not necessarily engineering. :roll_eyes:

firebirduino:
They stood on principle.

That would be the principle. :grinning:

Is there good solution to use 7 segment LED displays with 74HC595 via ISP 6pin connector on http://elm-chan.org

Paul__B:
In terms of making money, not necessarily engineering. :roll_eyes:

In production one wants guaranteed quality. It goes to that extend that testing components by independent companies before they are placed on the PCB is cheaper than fault finding afterwards.

And you don't want your ABS to fail because of some cheap counterfeit chip that dies after a few days driving :smiley: