Hi.
I searched to use display from my broken radioclock, its look the same as show here:
http://postimg.org/image/s5owqafz1/ (here i added output in red)
So it was finaly controled via two 74HC595
Here is the code for a fast clock:
long previous1 = 0;
long interval1 = 10;
long previous2 = 0;
long interval2 = 200;
int digit[4]={8,8,8,8};
int heure=0;
int minute=0;
int SER_Pin = 2; //pin 14 on the 75HC595 SPI mosi
int RCLK_Pin = 3; //pin 12 on the 75HC595 SPI ss
int SRCLK_Pin = 4; //pin 11 on the 75HC595 SPI clock
#define number_of_74hc595s 2
#define numOfRegisterPins number_of_74hc595s * 8
int phase = 0;
boolean registers[numOfRegisterPins];
byte seven_seg_digits[11][7] = { { 1,1,1,1,1,1,0 }, // = 0
{ 0,1,1,0,0,0,0 }, // = 1
{ 1,1,0,1,1,0,1 }, // = 2
{ 1,1,1,1,0,0,1 }, // = 3
{ 0,1,1,0,0,1,1 }, // = 4
{ 1,0,1,1,0,1,1 }, // = 5
{ 1,0,1,1,1,1,1 }, // = 6
{ 1,1,1,0,0,0,0 }, // = 7
{ 1,1,1,1,1,1,1 }, // = 8
{ 1,1,1,1,0,1,1 }, // = 9
{ 0,0,0,0,0,0,0 }, //
};
// A B C D E F G
byte seg[4][2][7]={{{2, 4, 3, 0, 0, 0, 0},
{0, 0, 0, 3, 5, 2, 4}},
{{0, 0, 0, 6, 5, 8, 7},
{8, 7, 6, 0, 0, 0, 0}},
{{9, 11,10,0, 0, 0, 0},
{0, 0, 0, 10,12,9, 11}},
{{0, 15,12,0, 13,0, 14},
{14,0, 0, 13,0, 0, 0}}};
void setup(){
pinMode(SER_Pin, OUTPUT);
pinMode(RCLK_Pin, OUTPUT);
pinMode(SRCLK_Pin, OUTPUT);
clearRegisters();
writeRegisters();
}
void clearRegisters(){
for(int i = numOfRegisterPins - 1; i >= 0; i--){
registers[i] = LOW;
}
}
void writeRegisters(){
digitalWrite(RCLK_Pin, LOW);
for(int i = numOfRegisterPins - 1; i >= 0; i--){
digitalWrite(SRCLK_Pin, LOW);
int val = registers[i];
digitalWrite(SER_Pin, val);
digitalWrite(SRCLK_Pin, HIGH);
}
digitalWrite(RCLK_Pin, HIGH);
}
void setRegisterPin(int index, int value){
registers[index] = value;
}
void loop()
{
long currentMillis = millis();
if(currentMillis - previous1 > interval1) {
clearRegisters();
previous1 = currentMillis;
for (byte d = 0; d < 4; ++d) {
for (byte segCount = 0; segCount < 7; ++segCount) {
int n=seg[d][phase][segCount];
if (n>0){
setRegisterPin(n,seven_seg_digits[digit[3-d]][segCount]);
}
}
}
if (phase==0){
setRegisterPin(0, 1);
setRegisterPin(1, 0);
}
if (phase==1){
setRegisterPin(0, 0);
setRegisterPin(1, 1);
}
writeRegisters();
phase++;
if (phase>1){phase=0;}
}
if(currentMillis - previous2 > interval2) {
previous2 = currentMillis;
minute++;
if (minute>59){
minute=0;
heure++;
}
if (heure>23){
heure=0;
}
int h1=heure/10;
if (h1==0){
digit[0]=10;}
else{
digit[0]=h1;
}
digit[1]=heure%10;
digit[2]=minute/10;
digit[3]=minute%10;
}
}