Připojení k Arduinu
Pin QDSP 2259 | Název pinu QDSP 2259 | Pin Arduino |
---|
1 | CLS | 5V |
2 | CLK | – |
3 | WR | A1 |
4 | CE | 10 |
5 | RST | A0 |
6 | RD | 11 |
7 | – | – |
8 | – | – |
9 | – | – |
10 | – | – |
11 | D0 | 0 |
12 | D1 | 1 |
13 | D2 | 2 |
14 | D3 | 3 |
15 | NC | – |
16 | Vdd | 5V |
17 | GND (SUPPLY) | GND |
18 | GND (LOGIC) | GND |
19 | D4 | 4 |
20 | D5 | 5 |
21 | D6 | 6 |
22 | D7 | 7 |
23 | – | – |
24 | – | – |
25 | – | – |
26 | – | – |
27 | FL | 5V |
28 | A0 | A2 |
29 | A1 | A3 |
30 | A2 | A4 |
31 | A3 | A5 |
32 | A4 | 5V |
Zdrojový kód pro Arduino
/*
Original code www.josvandijken.nl
Based on the code from: Matt Joyce < matt at nycresistor.com >
Mark Tabry
*/
int RST = A0;
int WR = A1;
int CE = 10;
int RD = 11;
int AD0 = A2;
int AD1 = A3;
int AD2 = A4;
int AD3 = A5;
int D0 = 0;
int D1 = 1;
int D2 = 2;
int D3 = 3;
int D4 = 4;
int D5 = 5;
int D6 = 6;
int D7 = 7;
int incomingByte = 0;
void setup()
{
pinMode(RST , OUTPUT);
pinMode(WR , OUTPUT);
pinMode(CE , OUTPUT);
pinMode(RD , OUTPUT);
pinMode(AD0 , OUTPUT);
pinMode(AD1 , OUTPUT);
pinMode(AD2 , OUTPUT);
pinMode(AD3 , OUTPUT);
pinMode(D0 , OUTPUT);
pinMode(D1 , OUTPUT);
pinMode(D2 , OUTPUT);
pinMode(D3 , OUTPUT);
pinMode(D4 , OUTPUT);
pinMode(D5 , OUTPUT);
pinMode(D6 , OUTPUT);
pinMode(D7 , OUTPUT);
digitalWrite(CE, HIGH);
digitalWrite(WR, HIGH);
resetDisplay();
}
void resetDisplay()
{
digitalWrite(RST, LOW);
delayMicroseconds(1);
digitalWrite(RST, HIGH);
delayMicroseconds(200);
digitalWrite(AD3, HIGH);
}
void writeDisplay(char *input)
{
for (int i = 0; i < 8; i++)
{
digitalWrite(AD0, (1 & i) != 0 ? HIGH : LOW);
digitalWrite(AD1, (2 & i) != 0 ? HIGH : LOW);
digitalWrite(AD2, (4 & i) != 0 ? HIGH : LOW);
PORTD = input[i];
delay(0);
digitalWrite(CE, LOW);
delay(0);
digitalWrite(WR, LOW);
delay(0);
digitalWrite(WR, HIGH);
delay(0);
digitalWrite(CE, HIGH);
//delay(5);
}
}
void scrollDisplay(char *words)
{
char buffer[8];
int i = 0;
while (words[i] != 0)
{
boolean blank = false;
for (int j = 0; j < 8; j++)
{
if ( !blank && words[i + j] == 0 )
{
blank = true;
}
if ( blank )
{
buffer[j] = ' ';
}
else
{
buffer[j] = words[i + j];
}
}
buffer[8] = 0;
writeDisplay(buffer);
delay(300);
i++;
}
}
void loop()
{
char intro[] = " *** QDSP 2259 DEMO *** MORE DISPLAYS ON CTVRTKY.INFO/SBIRKA-DISPLEJU-LED ";
scrollDisplay(intro);
}
Demo video