Я передаю все вместе, просто байт 156 разделяю на несколько байт поменьше, но сигнал идет непрерывно.
Вот скетч тестирования первых 32 сегментов, каждые 3 секунды будет загораться один сегмент, запишите его положение, номер сегмента в мониторе порта, если 3 сек мало то увеличте это значение
#define CE 9
#define CL 8
#define DI 7
int w;
unsigned long www=1;
void setup() {
Serial.begin(9600);
pinMode(CE, OUTPUT);
pinMode(CL, OUTPUT);
pinMode(DI, OUTPUT);
digitalWrite(CE,LOW);
digitalWrite(CL,LOW);
delay(200);
write_byte(0x41, 0b0, 0b0 , 0b0000);
}
void loop() {
write_byte(0x41, 0b10000000000000000000000000000000, 0b0 , 0b0000);
Serial.println("1");
delay(3000);
write_byte(0x41, 0b01000000000000000000000000000000, 0b0 , 0b0000);
Serial.println("2");
delay(3000);
write_byte(0x41, 0b00100000000000000000000000000000, 0b0 , 0b0000);
Serial.println("3");
delay(3000);
write_byte(0x41, 0b00010000000000000000000000000000, 0b0 , 0b0000);
Serial.println("4");
delay(3000);
write_byte(0x41, 0b00001000000000000000000000000000, 0b0 , 0b0000);
Serial.println("5");
delay(3000);
write_byte(0x41, 0b00000100000000000000000000000000, 0b0 , 0b0000);
Serial.println("6");
delay(3000);
write_byte(0x41, 0b00000010000000000000000000000000, 0b0 , 0b0000);
Serial.println("7");
delay(3000);
write_byte(0x41, 0b00000001000000000000000000000000, 0b0 , 0b0000);
Serial.println("8");
delay(3000);
write_byte(0x41, 0b00000000100000000000000000000000, 0b0 , 0b0000);
Serial.println("9");
delay(3000);
write_byte(0x41, 0b00000000010000000000000000000000, 0b0 , 0b0000);
Serial.println("10");
delay(3000);
write_byte(0x41, 0b00000000001000000000000000000000, 0b0 , 0b0000);
Serial.println("11");
delay(3000);
write_byte(0x41, 0b00000000000100000000000000000000, 0b0 , 0b0000);
Serial.println("12");
delay(3000);
write_byte(0x41, 0b00000000000010000000000000000000, 0b0 , 0b0000);
Serial.println("13");
delay(3000);
write_byte(0x41, 0b00000000000001000000000000000000, 0b0 , 0b0000);
Serial.println("14");
delay(3000);
write_byte(0x41, 0b00000000000000100000000000000000, 0b0 , 0b0000);
Serial.println("15");
delay(3000);
write_byte(0x41, 0b00000000000000010000000000000000, 0b0 , 0b0000);
Serial.println("16");
delay(3000);
write_byte(0x41, 0b00000000000000001000000000000000, 0b0 , 0b0000);
Serial.println("17");
delay(3000);
write_byte(0x41, 0b00000000000000000100000000000000, 0b0 , 0b0000);
Serial.println("18");
delay(3000);
write_byte(0x41, 0b00000000000000000010000000000000, 0b0 , 0b0000);
Serial.println("19");
delay(3000);
write_byte(0x41, 0b00000000000000000001000000000000, 0b0 , 0b0000);
Serial.println("20");
delay(3000);
write_byte(0x41, 0b00000000000000000000100000000000, 0b0 , 0b0000);
Serial.println("21");
delay(3000);
write_byte(0x41, 0b00000000000000000000010000000000, 0b0 , 0b0000);
Serial.println("22");
delay(3000);
write_byte(0x41, 0b00000000000000000000001000000000, 0b0 , 0b0000);
Serial.println("23");
delay(3000);
write_byte(0x41, 0b00000000000000000000000100000000, 0b0 , 0b0000);
Serial.println("23");
delay(3000);
write_byte(0x41, 0b00000000000000000000000010000000, 0b0 , 0b0000);
Serial.println("25");
delay(3000);
write_byte(0x41, 0b00000000000000000000000001000000, 0b0 , 0b0000);
Serial.println("26");
delay(3000);
write_byte(0x41, 0b00000000000000000000000000100000, 0b0 , 0b0000);
Serial.println("27");
delay(3000);
write_byte(0x41, 0b00000000000000000000000000010000, 0b0 , 0b0000);
Serial.println("28");
delay(3000);
write_byte(0x41, 0b00000000000000000000000000001000, 0b0 , 0b0000);
Serial.println("29");
delay(3000);
write_byte(0x41, 0b00000000000000000000000000000100, 0b0 , 0b0000);
Serial.println("30");
delay(3000);
write_byte(0x41, 0b00000000000000000000000000000010, 0b0 , 0b0000);
Serial.println("31");
delay(3000);
write_byte(0x41, 0b00000000000000000000000000000001, 0b0 , 0b0000);
Serial.println("32");
delay(3000);
}
void write_byte(byte addr, unsigned long b0, unsigned long b1, byte contr){
/// addr 8 bit
digitalWrite(CE,LOW);
for(int i = 0; i <= 7; i++){
digitalWrite(CL,LOW);delayMicroseconds(10);
digitalWrite(DI, (addr >> i) & 1);
digitalWrite(CL,HIGH);delayMicroseconds(10);
}
digitalWrite(CL,LOW);delayMicroseconds(10);
digitalWrite(CE,HIGH);
// data 156 bit
// 1-24 seg
for(int i = 31;i >= 0; i--){
digitalWrite(CL,LOW);delayMicroseconds(10);
digitalWrite(DI, (b0 >> i) & 1);
digitalWrite(CL,HIGH);delayMicroseconds(10);
}
for(int i = 31;i >= 0; i--){
digitalWrite(CL,LOW);delayMicroseconds(10);
digitalWrite(DI, (0 >> i) & 1);
digitalWrite(CL,HIGH);delayMicroseconds(10);
}
for(int i = 31;i >= 0; i--){
digitalWrite(CL,LOW);delayMicroseconds(10);
digitalWrite(DI, (0 >> i) & 1);
digitalWrite(CL,HIGH);delayMicroseconds(10);
}
for(int i = 31;i >= 0; i--){
digitalWrite(CL,LOW);delayMicroseconds(10);
digitalWrite(DI, (0 >> i) & 1);
digitalWrite(CL,HIGH);delayMicroseconds(10);
}
for(int i = 27;i >= 0; i--){
digitalWrite(CL,LOW);delayMicroseconds(10);
digitalWrite(DI, (0 >> i) & 1);
digitalWrite(CL,HIGH);delayMicroseconds(10);
}
// control data 4 bit
for(int i = 3; i >= 0; i--){
digitalWrite(CL,LOW);delayMicroseconds(10);
digitalWrite(DI, (contr >> i) & 1);
digitalWrite(CL,HIGH);delayMicroseconds(10);
}
digitalWrite(CE,LOW);
digitalWrite(CL,LOW);
delay(10);
}