This stuff could all go in setup():
clk8In(0x0C01); //normal Mode xxxx 1100 00000001 - shorten the function to match
clk8In(0x0900); //no-decode mode xxxx 1001 00000000
clk8In(0x0AFF); //max intensity xxxx 1010 11111111
clk8In(0x0B07); //scan limit //8-digit : xxxx 1011 00001111 <<< this is BF
loop() only needs to contain the stuff that changes, like sending digits:
//global
byte fontArray[] = {
0b00111111, // 0 assuming dp-g-f-e-d-c-b-a, which I think needs some adjusting in this case
0b00111001, // 1
0b01011011, // 2
etc this 9
};
void loop(){
clkIn(0x01); //xxxx 0001 ; digit DP0 position
clkIn (fontArray[2]); // look up segments for a 2 and sends it out
clkIn(0x02); //xxxx 0010 ; digit DP1 position
clkIn (fontArray[5]);
delay(1000);
clkIn(0x01); //xxxx 0001 ; digit DP0 position
clkIn (fontArray[6]); // look up segments for a x and sends it out
clkIn(0x02); //xxxx 0010 ; digit DP1 position
clkIn (fontArray[3]);
delay(1000);
}
Don't forget the chip select Low & High if that wasn't added already.
I normally use SPI.transfer myself
//make this a function
digitalWrite (ssPin, LOW);
SPI.transfer (address);
SPI.transfer (fontArray[dataToSend]);
digitalWrite (ssPin, HIGH);
where address is 1 to 8, and higher for the control registers.
Run at 4 MHz default speed.
Don't forget 0.1uF and 10uF caps on the Vcc pin.