       0b00000000   // blank
     };
 
-byte control_digit_pins[] = { digit0, digit1, digit2, digit3 };  // pins to turn off-&-on digits
 
 char matrix ()
 {

        digitalWrite(latchPin,LOW);  // [=latch down=]
        shiftOut(dataPin, clockPin, MSBFIRST, (displayDigits[x]));
        digitalWrite(latchPin,HIGH); // [=latch up=]
        digitalWrite(control_digit_pins[x], HIGH); // turn on one digit
        delay(1); // 1 or 2 is ok
    }
    display_off();
}

void hex2disp (int param, byte result[4]) {
    int temp = param;
    int mask = 0xF;
    for (int x=0; x<4; x++) {
        result[x] = table[(temp & mask)];
        temp = temp >> 4;
    }
}

unsigned char hex2bcd (unsigned char x)
{
    unsigned char y;
    y = (x / 10) << 4;
    y = y | (x % 10);
    return (y);
}

void int_to_time_str (int param, byte result[4]) {
    int minutes = param / 60;
    int seconds = param % 60;
    int minute_hi = minutes / 10;
    int minute_lo = minutes % 10;
    int second_hi = seconds / 10;
    int second_lo = seconds % 10;
    result[0] = table[second_lo];
    result[1] = table[second_hi];
    result[2] = table[minute_lo];
    result[3] = table[minute_hi];
}

int countdown_base = 90*60+21;
volatile int countdown;
unsigned long time = 0;

void loop() {
    /* time cycle */
    unsigned long new_time = millis();
    if ((new_time > (time + 200))) {
        time = new_time;
        /* Serial.println(time); */
        char symbol = matrix();
        if ('X' != symbol) {
            Serial.println(symbol);
        }
    }
    byte displayDigits[] = { 0b00111111, 0b00111000,
                             0b01110111, 0b01110110 };
    //hex2disp( countdown, displayDigits );
    int_to_time_str( countdown, displayDigits );
    DisplaySegments(displayDigits);
}

void setup() {

const int digit1   = 15;   // 7-Segment pin D3 J4
const int digit2   = 16;   // 7-Segment pin D2 J3
const int digit3   = 17;   // 7-Segment pin D1 J2
byte control_digit_pins[] = { digit0, digit1, digit2, digit3 };
const int clockPin = 18;   // 74HC595 pin 10 MR SRCLR J_CLR1 (1)
const int dataPin  = 19;  // 74HC595 pin 14 DS J_SER1 (4)
const int latchPin = 13;  // 74HC595 pin 12 STCP J_CLK1 (2)
