SDA5708-24D (Siemens)


Informace k displeji: https://www.sbprojects.net/knowledge/footprints/sda5708/index.php

Připojení k Arduinu

Pin SDA5708-24DNázev pinu SDA5708-24DPin Arduino
1Vcc5V
2LOADD2
3DATAD3
4SDCLKD4
5RESETD5
6GNDGND

Zdrojový kód pro Arduino

// original sketch niq_ro: http://arduinotehniq.blogspot.com/
#include "font.h"

int wait = 0;
const int LOAD  = 2;
const int DATA  = 3;
const int SDCLK  = 4;
const int RESET  = 5;
char msg[] = "       SDA-5708 DEMO";

void setup() {
  pinMode(DATA, OUTPUT);
  pinMode(LOAD, OUTPUT);
  pinMode(SDCLK, OUTPUT);
  pinMode(RESET, OUTPUT);
  init_SDA5708();
  brightness_SDA5708(0); //(0 = MAX, 7 = OFF)
}

void loop() {
  for (byte i = 0; i < (sizeof(msg) / sizeof(char)); i++) {
    for (byte j = 0; j < 8; j++) {
      if (i + j < (sizeof(msg) / sizeof(char))) {
        digit_to_SDA5708(msg[i + j], j );
      } else {
        digit_to_SDA5708(" ", j );
      }
    }
    delay(300);
  }
}

void init_SDA5708(void)
{
  digitalWrite(LOAD, HIGH);
  digitalWrite(RESET, LOW);
  digitalWrite(RESET, HIGH);
}

void digit_to_SDA5708(uint8_t sign, uint8_t digit)
{
  uint8_t i;
  if ((sign < 0x20) || (sign > 0x7b)) sign = 0x20;
  if (digit > 7) digit = 0;
  send_byte_to_SDA5708(0b10100000 | digit);
  for (i = 0; i < 7; i++) {
    send_byte_to_SDA5708(pgm_read_byte(&font[(sign - 0x20) * 7 + i]) / 8);
  }
}

void send_byte_to_SDA5708(uint8_t byte)
{
  uint8_t x;
  digitalWrite(LOAD, LOW);
  for (x = 0; x <= 7; x++) {
    if ((byte >> x) & 1) {
      digitalWrite(DATA, HIGH);
    } else {
      digitalWrite(DATA, LOW);
    }
    digitalWrite(SDCLK, HIGH);
    digitalWrite(SDCLK, LOW);
  }
  digitalWrite(LOAD, HIGH);
}

void brightness_SDA5708(uint8_t val)
{
  send_byte_to_SDA5708(0b11100000 | (val & 0b00000111));
}


Demo video

Leave a Reply