Тема: LC75853 — ЖКИ драйвер (Arduino)
Основная статья - http://rcl-radio.ru/?p=131929
http://rcl-radio.ru/wp-content/uploads/ … ne-smd.pdf
#define DELAY 1000
#define CE 3
#define CL 4
#define DI 2
long t=0b100000000000000000000;
void setup(){
Serial.begin(9600);
pinMode(CE, OUTPUT);
pinMode(CL, OUTPUT);
pinMode(DI, OUTPUT);
digitalWrite(CE,LOW);
digitalWrite(CL,LOW);
delay(200);
write_byte(0,0,0,0,0,0);
}
/*
b1 1 21
0b111111111111111111111
b2 22 42
0b111111111111111111111
b3 43 63
0b111111111111111111111
b4 64 84
0b111111111111111111111
b5 85 105
0b111111111111111111111
b6 106 126
0b111111111111111111111
*/
void loop(){
write_byte(0b111111111111111111111,0b111111111111111111111, 0b111111111111111111111,0b111111111111111111111, 0b111111111111111111111,0b111111111111111111111);
delay(5000);
for(int j=0;j<=20;j++){
write_byte(t>>j,0,0,0,0,0);
Serial.print(t>>j,BIN); Serial.print(" bit "); Serial.println(j+1);
delay(DELAY);
}
for(int j=0;j<=20;j++){
write_byte(0,t>>j,0,0,0,0);
Serial.print(t>>j,BIN); Serial.print(" bit "); Serial.println(j+22);
delay(DELAY);
}
for(int j=0;j<=20;j++){
write_byte(0,0,t>>j,0,0,0);
Serial.print(t>>j,BIN); Serial.print(" bit "); Serial.println(j+43);
delay(DELAY);
}
for(int j=0;j<=20;j++){
write_byte(0,0,0,t>>j,0,0);
Serial.print(t>>j,BIN); Serial.print(" bit "); Serial.println(j+64);
delay(DELAY);
}
for(int j=0;j<=20;j++){
write_byte(0,0,0,0,t>>j,0);
Serial.print(t>>j,BIN); Serial.print(" bit "); Serial.println(j+85);
delay(DELAY);
}
for(int j=0;j<=20;j++){
write_byte(0,0,0,0,0,t>>j);
Serial.print(t>>j,BIN); Serial.print(" bit "); Serial.println(j+106);
delay(DELAY);
}
}
void write_byte(long b1, long b2, long b3, long b4, long b5, long b6){
write_addr();
write_21(b1);
write_21(b2);
write_conf(0b00000000000100);
write_addr();
write_21(b3);
write_21(b4);
write_conf(0b00000000000001);
write_addr();
write_21(b5);
write_21(b6);
write_conf(0b00000000000010);
}
void write_addr(){
digitalWrite(CE,LOW);delayMicroseconds(10);
for(int i = 7; i >= 0; i--){
digitalWrite(CL,LOW);delayMicroseconds(10);
digitalWrite(DI, (0x42 >> i) & 1);
digitalWrite(CL,HIGH);delayMicroseconds(10);
}
digitalWrite(CL,LOW);
digitalWrite(CE,HIGH);
delayMicroseconds(10);
}
void write_21(long bb){
for(int i = 20;i >= 0; i--){
digitalWrite(CL,LOW);delayMicroseconds(10);
digitalWrite(DI, (bb >> i) & 1);
digitalWrite(CL,HIGH);delayMicroseconds(10);
}
}
void write_conf(long data_conf){
for(int i = 13;i >= 0; i--){
digitalWrite(CL,LOW);delayMicroseconds(10);
digitalWrite(DI, (data_conf >> i) & 1);
digitalWrite(CL,HIGH);delayMicroseconds(10);
}
digitalWrite(CE,LOW);delayMicroseconds(10);
}