Created
July 18, 2021 15:09
-
-
Save Lukelectro/f5c4d97682b9a9d57a022c0e95346002 to your computer and use it in GitHub Desktop.
Demo on 7003 asy board
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 10x PD2437 display module | |
* aangepast vanaf het voorbeeld van Aart | |
* | |
* Logic board: | |
* | |
* 34_pin function register function | |
* | |
* 1,2,3,4 V+ | |
* | |
* 5 D0 display A0 | |
* 6 D1 display A1 | |
* 7 D2 odd or !even column | |
* 8 D3 A0 row | |
* 9 D4 A1 row | |
* 10 D5 A2 row | |
* 11 D6 Display A2 | |
* 12 D7 EN or !EN module via ST2, pos 1 is !EN ( ? - klopt dit ?) | |
* | |
* 17 !EN module via ST2 | |
* 20 !EN module bia ST2, pos 1 Tie to GND. | |
* 19 !WR display | |
* 15 LE latch register | |
* | |
* 31,32 GND | |
* | |
*/ | |
#define D0 0 | |
#define D1 1 | |
#define D2 2 | |
#define D3 3 | |
#define D4 4 | |
#define D5 5 | |
#define D6 6 | |
#define D7 7 | |
#define LE 8 | |
#define WR 9 | |
void setup() { | |
// put your setup code here, to run once: | |
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 (WR, HIGH); | |
pinMode (WR, OUTPUT); | |
digitalWrite (LE, LOW); | |
pinMode (LE, OUTPUT); | |
clear_full_disp(); | |
brightness(3); | |
for(char disp=0;disp<40;disp++){ | |
module_9443_setDigit(Adress(disp),disp+0x41); | |
} | |
delay(5000); | |
} | |
void loop() { | |
const char text[] = "Hello World on \"7003-assy\" board Be excellent to each other & try to not to be on fire. An apple a day keeps the doctor away - does that mean apples repel doctors? And vice versa? Can doctors eat apples? 42 "; | |
static unsigned int i = 0; | |
for(char disp=0;disp<40;disp++){ | |
module_9443_setDigit(Adress(disp),text[(disp+i)%((sizeof text)-1)]); | |
} | |
delay(200); | |
i++; | |
} | |
void module_9443_setDigit (char digit, char content) { | |
// write address register | |
delayMicroseconds(2); | |
digitalWrite(LE, LOW); | |
writeData(digit); | |
delayMicroseconds(2); | |
digitalWrite(LE, HIGH); | |
delayMicroseconds(2); | |
//write data to digit | |
writeData(content); | |
delayMicroseconds(2); | |
digitalWrite(WR, LOW); | |
delayMicroseconds(2); | |
digitalWrite(WR, HIGH); | |
} | |
void writeData(byte Data) { | |
digitalWrite (D0,((Data >> 0) & 1)); | |
digitalWrite (D1,((Data >> 1) & 1)); | |
digitalWrite (D2,((Data >> 2) & 1)); | |
digitalWrite (D3,((Data >> 3) & 1)); | |
digitalWrite (D4,((Data >> 4) & 1)); | |
digitalWrite (D5,((Data >> 5) & 1)); | |
digitalWrite (D6,((Data >> 6) & 1)); | |
digitalWrite (D7,((Data >> 7) & 1)); | |
} | |
char Adress (char disp){ | |
/* input: display number 0-39, output what should be put on adress bus */ | |
// 0|(1<<6)|((disp&1)<<0)|((disp&2)<<1)|((disp&4)<<2)((disp&8)<<3)|((disp&16)<<4)((disp&32)<<5); // start at 0, leave EN low, set A2 for normal operation and the rest is displ. number | |
// or simper:return (disp&0x3F)|(0x40); | |
// except that is mirrored. row is correct, collumn is mirrord and digit 0-3 whitin a display is mirrored. So invert lower 3 bits. | |
return ((disp&0x3F)^0x07)|(0x40); | |
} | |
void controll(char disp, char cword){ | |
/* sends control word to display 0-39*/ | |
/* Cword: D7 = clear, D6 =lamp test, D5 = blink disp, d4 = enable attributes, d3,2 = atributes 00 cursor 01 blink char, 10 blink cursor 11 alternate curs/char d1,0=brightness */ | |
module_9443_setDigit((disp&0x3F)^0x07,cword); /* A2 is low, so control word*/ | |
} | |
void clear_full_disp(){ | |
for(char i=0;i<40;i++){ | |
controll(i,0x80); | |
} | |
} | |
void brightness (char br){ | |
if(br>3) br=3; | |
for(char i=0;i<40;i++){ | |
controll(i,br); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment