Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Arduino + ЖКИ МЭЛТ МТ10Т7-7
/* Example: MELT MT10T7-7 LCD display, directly connected to Arduino.
* Display datasheet: http://www.melt.com.ru/docs/MT-10T7_8_9.pdf
*/
// Other pins: GND to GND; +E to 5V; V0, +L and -L are not necessary for example purposes.
#define PIN_WR1 3
#define PIN_WR2 2
#define PIN_A0 13
#define PIN_DB0 9
#define PIN_DB1 10
#define PIN_DB2 11
#define PIN_DB3 12
#define SEG_A 8
#define SEG_B 32
#define SEG_C 64
#define SEG_D 4
#define SEG_E 2
#define SEG_F 128
#define SEG_G 1
#define SEG_H 16
void setup() {
pinMode(PIN_A0, OUTPUT);
pinMode(PIN_WR1, OUTPUT);
pinMode(PIN_WR2, OUTPUT);
pinMode(PIN_DB0, OUTPUT);
pinMode(PIN_DB1, OUTPUT);
pinMode(PIN_DB2, OUTPUT);
pinMode(PIN_DB3, OUTPUT);
digitalWrite(PIN_WR1, LOW);
digitalWrite(PIN_WR2, LOW);
}
void _write_dbs(byte nibble) {
digitalWrite(PIN_DB0, nibble & 1 ? HIGH : LOW);
digitalWrite(PIN_DB1, nibble & 2 ? HIGH : LOW);
digitalWrite(PIN_DB2, nibble & 4 ? HIGH : LOW);
digitalWrite(PIN_DB3, nibble & 8 ? HIGH : LOW);
}
void _write_wr() {
digitalWrite(PIN_WR2, LOW);
digitalWrite(PIN_WR1, HIGH);
delayMicroseconds(5);
digitalWrite(PIN_WR1, LOW);
}
void write_lcd_raw(byte addr, byte data) {
_write_dbs(addr & 15);
digitalWrite(PIN_A0, LOW);
_write_wr();
_write_dbs(data & 15);
digitalWrite(PIN_A0, HIGH);
_write_wr();
_write_dbs((data >> 4) & 15);
_write_wr();
// Unnecessary cleanup
digitalWrite(PIN_A0, LOW);
_write_dbs(0);
}
static byte STR_HELLO[5] = {
SEG_F | SEG_E | SEG_G | SEG_B | SEG_C,
SEG_A | SEG_F | SEG_G | SEG_E | SEG_D,
SEG_F | SEG_E | SEG_D,
SEG_F | SEG_E | SEG_D,
SEG_F | SEG_E | SEG_D | SEG_A | SEG_B | SEG_C
};
void loop() {
for (int i = 0; i < 10; i++) {
write_lcd_raw(i, 0);
}
delay(500);
for (int i = 0; i < 10; i++) {
write_lcd_raw(i, SEG_G);
delay(100);
}
delay(1000);
for (int i = 0; i < 10; i++) {
write_lcd_raw(i, 0);
}
int offset = 3;
int dir = 1;
while (1) {
for (int i = 0; i < 5; i++) {
write_lcd_raw(offset + i, STR_HELLO[i]);
}
if (offset > 0) { write_lcd_raw(offset - 1, 0); }
if (offset < 5) { write_lcd_raw(offset + 5, 0); }
delay(250);
offset += dir;
if (offset == 0 || offset == 5) { dir = -dir; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment