Pages: [1]   Go Down
Author Topic: 595 Shift register problems.  (Read 628 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

1.
I bought two 74HC595 shift registers with plans of using them to power 4x7 segment displays, and am working through this tutorial to learn how to use them: http://arduino.cc/en/Tutorial/ShiftOut

I am fairly certain everything is wired up ok, loaded the first program but all it does it just light the first LED continually, where from the discription it should cycle through the numbers 0-255 in binary using the 8 LED's.



2.
All the tutorial I can find use common cathode 4x7 segment displays, however the ones I bought are common anode, does anyone now of a tutorial for powering a common anode 4x7 segment display using 595 shift registers?
« Last Edit: September 09, 2012, 11:58:00 pm by Riley-NZL » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

An attempt at photographing the setup:





Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 27418
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you have the 1uF cap on the ST_CP pins? Take that off.
Put a 0.1uF cap from Vcc on the 595s to nearest Gnd.

"common annode 4x7 segment displays, however the ones I bought are common anode,"
Well, I am pretty sure 1 extra n in anode won't make much difference.

The shiftout uses common cathode.
If you  have common anode, then you need drive the cathodes low to turn the segments on.

So instead of 1 indicating an On segment here:
Code:
 //Arduino doesn't seem to have a way to write binary straight into the code
  //so these values are in HEX.  Decimal would have been fine, too.
  dataArrayRED[0] = 0xFF; //11111111
  dataArrayRED[1] = 0xFE; //11111110
  dataArrayRED[2] = 0xFC; //11111100
  dataArrayRED[3] = 0xF8; //11111000
  dataArrayRED[4] = 0xF0; //11110000
  dataArrayRED[5] = 0xE0; //11100000
  dataArrayRED[6] = 0xC0; //11000000
  dataArrayRED[7] = 0x80; //10000000
  dataArrayRED[8] = 0x00; //00000000
  dataArrayRED[9] = 0xE0; //11100000
a 0 will indicate on instead - flip all the bits over.
For example, define a digitArray:
Code:
digitArray[0] = {B01000000};  //bit 0 = segment A, 1 = B, 2 = C, 3 = D, 4 = E, 5 = F, 6 = G, 7 = decimal point is used
digitArray[1] = {B00000110};
digitArray[2] = {B01011011};
digitArray[3] = {B01001111};
digitArray[4] = {B01100110};
digitArray[5] = {B01101101};
digitArray[6] = {B01111101};
digitArray[7] = {B00000111};
digitArray[8] = {B01111111};
digitArray[9] = {B01110011};

and send the data out via SPI:

digitalWrite (SS, LOW);
SPI.transfer (digitalArray[hi_number_to_send]);
SPI.transfer (digitalArray[lo_number_to_send]);
digitalWrite (SS, HIGH);

hi_number_to_send & lo_number_to_send are values from 0 to 9

SCK is connected to RCK on both chips
SS is connected to SRCK on both chips
MOSI is connected to serial data in on chip 1, Q7/ from chip 1 goes to serial data in on chip 2
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, not using a cap at all, I'll give that a try.

And sorry, meant the guides are for common cathode.
Logged

Pages: [1]   Go Up
Jump to: