Hi all,

This is my first post here.

I just started learning about arduino recently and I am currently trying to build a two digit count down timer 0 - 99

I ran into a little bit of trouble and I am hoping someone here can give me some guidance..

my problem is that I can't seem to get it to display the numbers corectly and I don't know what I am doing wrong, now the sequence of numbers that it displays is :

0,0,00,1,4,5,66 and it loops back from 1

I have:

1. 2 digit seven segment display wich is common anode, here is the datasheet http://www.tme.eu/ro/Document/71648f1175f76e1e159746772133195f/LD-D036XX.pdf

2. 2x 74hc595 8 bit shift registers

I attached a picture of my wiring

my code is:

/*

B number order

A - 3

B - 9

C - 8

D - 6

E - 7

F - 4

G - 1

DP - 2

*/

const byte ledCharSet[10] =

{

B11000000,

B11111001,

B11111001,

B10110000,

B10011001,

B10010010,

B10000011,

B11111000,

B10000000,

B10011000

};

const int latchPin = 8;

const int clockPin = 10;

const int dataPin = 9;

void setup()

{

pinMode(latchPin, OUTPUT);

pinMode(clockPin, OUTPUT);

pinMode(dataPin, OUTPUT);

}

void loop() {

for (int i = 0; i < 100 ; i++) {

DisplayNumber(i);

delay(600);

}

}

void DisplayNumber(int num) {

int tens;

int ones;

if (num > 100 || num < 0) {

num = 0;

}

ones = num % 10;

if (num < 10) {

tens = 0;

}

else {

tens = num -(num/10)*10;

}

digitalWrite(latchPin, 0);

shiftOut(dataPin, clockPin, MSBFIRST, ledCharSet[ones]);

shiftOut(dataPin, clockPin, MSBFIRST, ledCharSet[tens]);

digitalWrite(latchPin, 1);

Serial.print(ones);

Serial.print("\n");

Serial.print(tens);

Serial.print("\n");

}

Can anyone please help me with this issue?

Thank you!