1990-0553 (Hewlett Packard)


Připojení k Arduinu

Pin 1990-0553Název pinu 1990-0553Pin Arduino
1C412
2C311
3C210
4C19
5C08
6
7Data OUT
8Vcc+5V
9Vcc+5V
10CLK6
11GNDGND
12Data IN7

Zdrojový kód pro Arduino

//*** 1990-0553 (Hewlett Packard)
//*** ASCII-DEMO
//*** From original code:
//*** phuinink@gmail.com
//*** Paul Huinink has a webpage on displays www.huinink.info and specifically HDSP200X series displays www.spagmon.com
//*** Modified December-2013 by Patrick Hickey: added HP HDSP single digit display and RGB LED
//*** Patrick Hickey ph@nipht.com

// an array of 5 bytes per ASCII
// 5 bytes cause 5 columns
// 7 bits per column (no LSB)
const byte ascii_5x7[] = {
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0xF2, 0x00, 0x00,// !
  0x00, 0xE0, 0x00, 0xE0, 0x00,// "
  0x28, 0xFE, 0x28, 0xFE, 0x28,// #
  0x24, 0x54, 0xFE, 0x54, 0x48,// $
  0xC4, 0xC8, 0x10, 0x26, 0x46,// %
  0x6C, 0x92, 0xAA, 0x44, 0x0A,// &
  0x00, 0xA0, 0xC0, 0x00, 0x00,// 39
  0x00, 0x38, 0x44, 0x82, 0x00,// 40
  0x00, 0x82, 0x44, 0x38, 0x00,// 41
  0x28, 0x10, 0x7C, 0x10, 0x28,// *
  0x10, 0x10, 0x7C, 0x10, 0x10,
  0x00, 0x0A, 0x0C, 0x00, 0x00,
  0x10, 0x10, 0x10, 0x10, 0x10,
  0x00, 0x06, 0x06, 0x00, 0x00,
  0x04, 0x08, 0x10, 0x20, 0x40,
  0x7C, 0x8A, 0x92, 0xA2, 0x7C,//48 0
  0x00, 0x42, 0xFE, 0x02, 0x00,//49 1
  0x42, 0x86, 0x8A, 0x92, 0x62,//50 2
  0x84, 0x82, 0xA2, 0xD2, 0x8C,
  0x18, 0x28, 0x48, 0xFE, 0x08,
  0xE4, 0xA2, 0xA2, 0xA2, 0x9C,
  0x3C, 0x52, 0x92, 0x92, 0x0C,
  0x80, 0x8E, 0x90, 0xA0, 0xC0,
  0x6C, 0x92, 0x92, 0x92, 0x6C,
  0x60, 0x92, 0x92, 0x94, 0x78,
  0x00, 0x6C, 0x6C, 0x00, 0x00,
  0x00, 0x6A, 0x6C, 0x00, 0x00,
  0x10, 0x28, 0x44, 0x82, 0x00,
  0x28, 0x28, 0x28, 0x28, 0x28,
  0x00, 0x82, 0x44, 0x28, 0x10,
  0x40, 0x80, 0x8A, 0x90, 0x60,
  0x4C, 0x92, 0x9E, 0x82, 0x7C,
  0x7E, 0x88, 0x88, 0x88, 0x7E,//65 A
  0xFE, 0x92, 0x92, 0x92, 0x6C,
  0x7C, 0x82, 0x82, 0x82, 0x44,
  0xFE, 0x82, 0x82, 0x44, 0x38,
  0xFE, 0x92, 0x92, 0x92, 0x82,
  0xFE, 0x90, 0x90, 0x90, 0x80,// 70
  0x7C, 0x82, 0x92, 0x92, 0x5E,
  0xFE, 0x10, 0x10, 0x10, 0xFE,
  0x00, 0x82, 0xFE, 0x82, 0x00,
  0x04, 0x02, 0x82, 0xFC, 0x80,
  0xFE, 0x10, 0x28, 0x44, 0x82,
  0xFE, 0x02, 0x02, 0x02, 0x02,
  0xFE, 0x40, 0x30, 0x40, 0xFE,
  0xFE, 0x20, 0x10, 0x08, 0xFE,
  0x7C, 0x82, 0x82, 0x82, 0x7C,
  0xFE, 0x90, 0x90, 0x90, 0x60,// P
  0x7C, 0x82, 0x8A, 0x84, 0x7A,
  0xFE, 0x90, 0x98, 0x94, 0x62,
  0x62, 0x92, 0x92, 0x92, 0x8C,
  0x80, 0x80, 0xFE, 0x80, 0x80,
  0xFC, 0x02, 0x02, 0x02, 0xFC,
  0xF8, 0x04, 0x02, 0x04, 0xF8,
  0xFC, 0x02, 0x0C, 0x02, 0xFC,
  0xC6, 0x28, 0x10, 0x28, 0xC6,
  0xE0, 0x10, 0x0E, 0x10, 0xE0,
  0x86, 0x8A, 0x92, 0xA2, 0xC2,
  0x00, 0xFE, 0x82, 0x82, 0x00,
  0x40, 0x20, 0x10, 0x08, 0x04,
  0x00, 0x82, 0x82, 0xFE, 0x00,
  0x20, 0x40, 0x80, 0x40, 0x20,
  0x02, 0x02, 0x02, 0x02, 0x02,
  0x00, 0x80, 0x40, 0x20, 0x00,
  0x04, 0x2A, 0x2A, 0x2A, 0x1E,
  0xFE, 0x12, 0x12, 0x12, 0x0C,
  0x1C, 0x22, 0x22, 0x22, 0x22,
  0x0C, 0x12, 0x12, 0x12, 0xFE,// 100 d
  0x1C, 0x2A, 0x2A, 0x2A, 0x1A,// 101 e
  0x00, 0x10, 0x7E, 0x90, 0x40,
  0x12, 0x2A, 0x2A, 0x2A, 0x3C,
  0xFE, 0x10, 0x10, 0x10, 0x0E,
  0x00, 0x00, 0x5E, 0x00, 0x00,
  0x04, 0x02, 0x02, 0xBC, 0x00,
  0x00, 0xFE, 0x08, 0x14, 0x22,
  0x00, 0x82, 0xFE, 0x02, 0x00,
  0x3E, 0x20, 0x1C, 0x20, 0x3E,
  0x3E, 0x10, 0x20, 0x20, 0x1E,
  0x1C, 0x22, 0x22, 0x22, 0x1C,
  0x3E, 0x28, 0x28, 0x28, 0x10,
  0x10, 0x28, 0x28, 0x28, 0x3E,
  0x3E, 0x10, 0x20, 0x20, 0x10,
  0x12, 0x2A, 0x2A, 0x2A, 0x24,
  0x20, 0x20, 0xFC, 0x22, 0x24,
  0x3C, 0x02, 0x02, 0x02, 0x3C,
  0x38, 0x04, 0x02, 0x04, 0x38,
  0x3C, 0x02, 0x0C, 0x02, 0x3C,// x
  0x22, 0x14, 0x08, 0x14, 0x22,// y
  0x20, 0x12, 0x0C, 0x10, 0x20,// z
  0x22, 0x26, 0x2A, 0x32, 0x22,//123 {
  0x00, 0x10, 0x6C, 0x82, 0x82,//124 |
  0x00, 0x00, 0xEE, 0x00, 0x00,//125 }
  0x82, 0x82, 0x6C, 0x10, 0x00,
  0x20, 0x40, 0x40, 0x40, 0x80,
  0xA8, 0x68, 0x3E, 0x68, 0xA8,
  0xBE, 0x2A, 0x2A, 0x2A, 0xA2,
  0x00, 0x20, 0x50, 0xA0, 0x00,
  0x04, 0x22, 0x7C, 0xA0, 0x40,
  0x84, 0xFC, 0x04, 0x00, 0x20,
  0xFE, 0x02, 0x02, 0x12, 0x02,
  0x1C, 0x22, 0x14, 0x08, 0x36,
  0x4E, 0x3E, 0x60, 0x40, 0x40
};

int column[] = {12, 11, 10, 9, 8}; // change this to other general input/output arduino-pins as you like
int data = 7;   // change this to other general input/output arduino-pins as you like
int clock = 6;  // change this to other general input/output arduino-pins as you like
const int numberOflDisplays = 1; // change this if total number of HDSP200x's is different.

int tekstDat[numberOflDisplays * 4 * 5]; // this is the array that store's what on the displays. 4 digits per display and 5 columns per digit.

unsigned long tijd; // used to trigger events in one of the examples below

void setup() {
  for (int i = 0; i < 5; i++) {
    pinMode(column[i], OUTPUT);
  }
  for (int i = 0; i < 5; i++) {
    digitalWrite(column[i], LOW);
  }
  pinMode(data, OUTPUT);
  pinMode(clock, OUTPUT);
  digitalWrite(data, LOW);
  digitalWrite(clock, HIGH);
  tijd = millis();
}

void loop() {

  char clr[] = "    ";
  char demo[] = "1990-0553 (Hewlett Packard) DEMO";
  scrollText(demo, 30);
  delay(500);
}
//****************end of loop *********************************

void writeDigit(int positie, int ascii) {
  for (int i = 0; i < 5; i++) {
    tekstDat[(numberOflDisplays * 4 - positie) * 5 + i] = ascii_5x7[ascii * 5 + i];
  }
}

void scrollText(String tekkst, long howSlow) {
  int leng = tekkst.length();
  for (int u = -numberOflDisplays * 4; u < leng; u++) { // first N digits will be spaces. N = all digits of display. So one screen blank before first character apears.
    for (int v = 0; v < numberOflDisplays * 4; v++) {
      if (( (u + v) >= 0 ) && ((u + v) < leng)) { // separete leading and tailing spaces from actual string
        char oneChar = tekkst.charAt(u + v);
        writeDigit(v + 1, oneChar); // write the character of the string
      }
      else {
        writeDigit(v + 1, 32); // write ascii-value 32 = a space.
      }
    }
    for (long teller = 0; teller < howSlow; teller++) {
      draw();
    }
  }
}

void writeText(String tekst) {
  int tl = tekst.length();
  int spacesNeeded = 4 * numberOflDisplays - tl;
  if (spacesNeeded < 0) {
    tl = 4 * numberOflDisplays;
  }
  else {
    for (int u = 0; u < spacesNeeded; u++) {
      tekst.concat(" ");
    }
    tl = 4 * numberOflDisplays;
  }
  char tekst_[tl];
  for (int vv = 0; vv < tl; vv++) {
    char tt = tekst.charAt(tl - vv - 1);
    for (int i = 0; i < 5; i++) {
      tekstDat[vv * 5 + i] = ascii_5x7[tt * 5 + i];
    }
  }
}

void dot(byte x, byte y, boolean oo) {
  if ((x < (numberOflDisplays * 4 * 5)) && (y < 7)) {
    byte oldByte = tekstDat[x] & (0xFF - (2 << y));
    tekstDat[x] = oldByte | (2 << y);
  }
}

void draw() {
  for (int Kolom = 0; Kolom < 5; Kolom++) { // 5 columns to be strobed
    // pumping in 3 x 4 x 7 bits per one stobe of the column
    for (int displayNo = 0; displayNo < numberOflDisplays; displayNo++) { // number of  displays
      for (int digitNo = 0; digitNo < 4; digitNo++) { // 4 characters per display
        for (int diodeNo = 0; diodeNo < 7; diodeNo++) { // 7 row-elements
          digitalWrite(clock, HIGH);
          digitalWrite(data, tekstDat[Kolom + 5 * (displayNo * 4 + digitNo) ] & (2 << diodeNo)); // magic
          digitalWrite(clock, LOW);
        }
      }
    }
    digitalWrite(column[Kolom], HIGH);
    delayMicroseconds(1500);
    digitalWrite(column[Kolom], LOW);
  }
}

Demo video

Leave a Reply