Help with seven-segment display and 74hc595n

I'm using an arduino uno, a Kingbright SA52-11HWA and a 74hc959n. The problem is: I don't know if the SSD has a common anode or cathode and the datasheets don't specify it. I did some test directly connecting some of the pins to the arduino ground through a 1k resistor (the lowest I had) and the middle pins ( 3 & 8 )
to 5V. It worked perfectly. Then I wired everything so:

and used this code

void setup(){
  pinMode(3, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(9, OUTPUT);
}

void loop(){
  digitalWrite(9, HIGH);
  sendBit(true);
  sendBit(true);
  sendBit(true);
  sendBit(true);
  sendBit(true);
  sendBit(true);
  sendBit(false);
  sendBit(false);
  digitalWrite(5, HIGH);
  digitalWrite(5, LOW);
  delay(1000);
  digitalWrite(3, HIGH);
  delay(250);
  digitalWrite(3, LOW);
  delay(250);
  digitalWrite(3, HIGH);
  delay(250);
  digitalWrite(3, LOW);
  delay(1000);
  digitalWrite(9, LOW);
}

void sendBit(boolean state){
  digitalWrite(1, state);
  digitalWrite(7, HIGH);
  digitalWrite(7, LOW);
  digitalWrite(1, LOW); 
}

by using 74HC595N Datasheet(PDF) - NXP Semiconductors (Page 4) and SA52-11HWA Datasheet(PDF) - Kingbright Corporation (Page 1, bottom)

Are you sure it's not a SR52-11EWA? The Kingbright site doesn't show an SR52-11HWA.

The EWA are Common Anode.

Hi ferrapellifo,

Your code is a little hard to follow. Suggest you set some consts up to represent the meaning of each of the arduino pins you are using (ie. The 595 pins they connect to).

You should only need 3 pins to control the 595: data, clock and latch. The other 2 can be tied high or low.

The best way to send data to the 595 is to use the shiftOut function:
http://arduino.cc/en/Reference/ShiftOut

The "A" in the kingbright product code tells you its a common anode, but you found that out anyway for yourself.

You will need some lower value reststors for the segments, somewhere around 100-300 ohms should work.

So what do you see? What is wrong?

Paul

@johnwasser It says SA52 11HWA. I bought it in germany. Could that be the reason for the non-existence of the ssd?

@PaulRB thanks, ShiftOut() with the example wiring works.

I had no problem finding the data sheet in the UK: http://www.rapidonline.com/pdf/57-0110e.pdf

"The best way to send data to the 595 is to use the shiftOut function"
Bah - the best way is with SPI!

Create an array with the font to be used:
fontArray[]= {
B00111111, // 0 a bit 7 = dp, 6=g, 5=f, 4=e, 3=d, 2=c, 1=b, 0=a
B00000110, // 1 f b
etc up to 9: g
B01101111, // 9 e c
} // d dp

then send it out:
digitalWrite (ssPin, LOW);
SPI.transfer(fontArray[byte_numberToDisplay]);
digitalWrite (ssPin, HIGH);

don't forget a 0.1uF cap from Vcc pin to Gnd.
Put a current limit resistor between each output pin & the LED pin.
SCK connects to SCLK
MOSI connects to DataIn
ssPin (generally 10) connects to SRCK
MRCLR connect to+5
OE/ connect to Gnd, or a PWM pin if you want brightness control

You indicated common anode - then flip all the bits in the array, so 0 is on and 1 is off.
11000000 = 0
11111001 = 1 etc