QDSP-2018 (Hewlett Packard)


Připojení k Arduinu

Pin QDSP-2018Název pinu QDSP-2018Pin Arduino
1C112
2C211
3C310
4C49
5C58
6
7Data OUT
8Vb
9Vcc+5V
10CLK6
11GNDGND
12Data IN7

Zdrojový kód pro Arduino

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,
};

int column[] = {12, 11, 10, 9, 8}; 
int data = 7;   
int clock = 6;
int brightness = 3000; 
const int cntDisplays = 1;
int txtData[cntDisplays * 4 * 5]; // this is the array that store's what on the displays. 4 digits per display and 5 columns per digit.

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);
}

void loop() {
  char PROGMEM scroll[]  = "QDSP-2018 DEMO";
  scrollText(scroll, 30);
}

void writeDigit(int position, int ascii) {
  for (int i = 0; i < 5; i++) {
    txtData[(cntDisplays * 4 - position) * 5 + i] = ascii_5x7[ascii * 5 + i];
  }
}

void scrollText(String txt, long howSlow) {
  int leng = txt.length();
  for (int u = -cntDisplays * 4; u < leng; u++) { 
    for (int v = 0; v < cntDisplays * 4; v++) {
      if (( (u + v) >= 0 ) && ((u + v) < leng)) { 
        char oneChar = txt.charAt(u + v);
        writeDigit(v + 1, oneChar); 
      }
      else {
        writeDigit(v + 1, 32); 
      }
    }
    for (long teller = 0; teller < howSlow; teller++) {
      draw();
    }
  }
}

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

void draw() {
  for (int columnDisp = 0; columnDisp < 5; columnDisp++) { 
    for (int displayNr = 0; displayNr < cntDisplays; displayNr++) { 
      for (int digitNr = 0; digitNr < 4; digitNr++) { 
        for (int diodeNr = 0; diodeNr < 7; diodeNr++) { 
          digitalWrite(clock, HIGH);
          digitalWrite(data, txtData[columnDisp + 5 * (displayNr * 4 + digitNr) ] & (2 << diodeNr)); 
          digitalWrite(clock, LOW);
        }
      }
    }
    digitalWrite(column[columnDisp], HIGH);
    delayMicroseconds(brightness);
    digitalWrite(column[columnDisp], LOW);
  }
}


Demo video

Leave a Reply