PLCD5583 (SIEMENS)

PLCD558x


Připojení k Arduinu

Pin PLCD5583Název pinu PLCD5583Pin Arduino
1RSTA0
2FLA1
3A0A2
4A1A3
5A2A4
6A3A5
7NC
8NC
9NC
10NC
11CLKSEL
12CLK I/O
13WRA2
14Vcc5V
15GND (supply)GND
16GND (logic)GND
17CEA3
18NC
19D06
20D17
21
22
23D28
24D39
25D410
26D511
27D612
28D713

Zdrojový kód pro Arduino

// sketch based on source from: https://github.com/abzman/PLCD5583

int addrPins[4] = {2, 3, 4, 5};
int dataPins[8] = {6, 7, 8, 9, 10, 11, 12, 13};
int resetPin = A0; //active low
int flashPin = A1; //active low
int writePin = A2; //active low
int enablePin = A3; //active low
char msg[] = "        *** PLCD5583 DEMO ***    MORE DISPLAYS ON CTVRTKY.CZ/SBIRKA-DISPLEJU-LED        ";
int brightness = 1;

void setup() {
  for (int i = 0; i < 4; ++i) pinMode(addrPins[i], OUTPUT);
  for (int i = 0; i < 8; ++i) pinMode(dataPins[i], OUTPUT);
  pinMode(resetPin, OUTPUT);
  pinMode(flashPin, OUTPUT);
  pinMode(writePin, OUTPUT);
  pinMode(enablePin, OUTPUT);

  digitalWrite(resetPin, HIGH);
  digitalWrite(flashPin, HIGH);
  digitalWrite(writePin, HIGH);
  digitalWrite(enablePin, LOW);

  setCommand();
  
  for (byte i = 0; i < (sizeof(msg) / sizeof(char)); i++) {
    writeLED(msg[i + 7], 7);
    writeLED(msg[i + 6], 6);
    writeLED(msg[i + 5], 5);
    writeLED(msg[i + 4], 4);
    writeLED(msg[i + 3], 3);
    writeLED(msg[i + 2], 2);
    writeLED(msg[i + 1], 1);
    writeLED(msg[i], 0);
    if (i == (sizeof(msg) / sizeof(char)) - 1) {
      i = 0;
    }
    delay(350);
  }
}

boolean isBitSet(byte data, int i) {
  return ((data & (1 << i)) >> i);
}

void write(byte data) {
  for (int i = 0; i < 8; ++i)
    digitalWrite(dataPins[i], isBitSet(data, i));
  latch();
}

void latch()
{
  //Latch out our write
  digitalWrite(writePin, LOW);
  delay(10);
  digitalWrite(writePin, HIGH);
}

void writeLED(char c, int digit) {

  //Address Decode
  digitalWrite(addrPins[0], (digit % 2) ? HIGH : LOW);
  digitalWrite(addrPins[1], ((digit / 2) % 2) ? HIGH : LOW);
  digitalWrite(addrPins[2], (digit > 3) ? HIGH : LOW);
  digitalWrite(addrPins[3], HIGH);

  //Write our character
  write(c);
}

void setCommand()
{
  digitalWrite(addrPins[3], LOW);
  if (brightness < 8)
  {
    digitalWrite(dataPins[2], (brightness > 3) ? LOW : HIGH);
    digitalWrite(dataPins[1], ((brightness / 2) % 2) ? LOW : HIGH);
    digitalWrite(dataPins[0], (brightness % 2) ? LOW : HIGH);
    latch();
  }
  digitalWrite(addrPins[3], HIGH);
}


void loop() {
}


Demo video

Leave a Reply