ПИУ-2. Оживляем плазменный текстовый индикатор из СССР

wr4fwsz10vkfhfzjgyjpbh44uf8.jpeg

const uint8_t System5×7C[156][5] = {
{0×00, 0×00, 0×00, 0×00, 0×00},// (space)
{0×00, 0×00, 0×5F, 0×00, 0×00},//!
{0×00, 0×07, 0×00, 0×07, 0×00},// »
{0×14, 0×7F, 0×14, 0×7F, 0×14},// #
{0×24, 0×2A, 0×7F, 0×2A, 0×12},// $
{0×23, 0×13, 0×08, 0×64, 0×62},// %
{0×36, 0×49, 0×55, 0×22, 0×50},// &
{0×00, 0×05, 0×03, 0×00, 0×00},// '
{0×00, 0×1C, 0×22, 0×41, 0×00},// (
{0×00, 0×41, 0×22, 0×1C, 0×00},//)
{0×08, 0×2A, 0×1C, 0×2A, 0×08},// *
{0×08, 0×08, 0×3E, 0×08, 0×08},// +
{0×00, 0×50, 0×30, 0×00, 0×00},//,
{0×08, 0×08, 0×08, 0×08, 0×08},// — {0×00, 0×60, 0×60, 0×00, 0×00},//.
{0×20, 0×10, 0×08, 0×04, 0×02},// /
{0×3E, 0×51, 0×49, 0×45, 0×3E},// 0
{0×00, 0×42, 0×7F, 0×40, 0×00},// 1
{0×42, 0×61, 0×51, 0×49, 0×46},// 2
{0×21, 0×41, 0×45, 0×4B, 0×31},// 3
{0×18, 0×14, 0×12, 0×7F, 0×10},// 4
{0×27, 0×45, 0×45, 0×45, 0×39},// 5
{0×3C, 0×4A, 0×49, 0×49, 0×30},// 6
{0×01, 0×71, 0×09, 0×05, 0×03},// 7
{0×36, 0×49, 0×49, 0×49, 0×36},// 8
{0×06, 0×49, 0×49, 0×29, 0×1E},// 9
{0×00, 0×36, 0×36, 0×00, 0×00},//:
{0×00, 0×56, 0×36, 0×00, 0×00},//;
{0×00, 0×08, 0×14, 0×22, 0×41},//
{0×14, 0×14, 0×14, 0×14, 0×14},// =
{0×41, 0×22, 0×14, 0×08, 0×00},// >
{0×02, 0×01, 0×51, 0×09, 0×06},//?
{0×32, 0×49, 0×79, 0×41, 0×3E},// @
{0×7E, 0×11, 0×11, 0×11, 0×7E},// A
{0×7F, 0×49, 0×49, 0×49, 0×36},// B
{0×3E, 0×41, 0×41, 0×41, 0×22},// C
{0×7F, 0×41, 0×41, 0×22, 0×1C},// D
{0×7F, 0×49, 0×49, 0×49, 0×41},// E
{0×7F, 0×09, 0×09, 0×01, 0×01},// F
{0×3E, 0×41, 0×41, 0×51, 0×32},// G
{0×7F, 0×08, 0×08, 0×08, 0×7F},// H
{0×00, 0×41, 0×7F, 0×41, 0×00},// I
{0×20, 0×40, 0×41, 0×3F, 0×01},// J
{0×7F, 0×08, 0×14, 0×22, 0×41},// K
{0×7F, 0×40, 0×40, 0×40, 0×40},// L
{0×7F, 0×02, 0×04, 0×02, 0×7F},// M
{0×7F, 0×04, 0×08, 0×10, 0×7F},// N
{0×3E, 0×41, 0×41, 0×41, 0×3E},// O
{0×7F, 0×09, 0×09, 0×09, 0×06},// P
{0×3E, 0×41, 0×51, 0×21, 0×5E},// Q
{0×7F, 0×09, 0×19, 0×29, 0×46},// R
{0×46, 0×49, 0×49, 0×49, 0×31},// S
{0×01, 0×01, 0×7F, 0×01, 0×01},// T
{0×3F, 0×40, 0×40, 0×40, 0×3F},// U
{0×1F, 0×20, 0×40, 0×20, 0×1F},// V
{0×7F, 0×20, 0×18, 0×20, 0×7F},// W
{0×63, 0×14, 0×08, 0×14, 0×63},// X
{0×03, 0×04, 0×78, 0×04, 0×03},// Y
{0×61, 0×51, 0×49, 0×45, 0×43},// Z
{0×00, 0×00, 0×7F, 0×41, 0×41},// [
{0×02, 0×04, 0×08, 0×10, 0×20},// »\»
{0×41, 0×41, 0×7F, 0×00, 0×00},// ]
{0×04, 0×02, 0×01, 0×02, 0×04},// ^
{0×40, 0×40, 0×40, 0×40, 0×40},// _
{0×00, 0×01, 0×02, 0×04, 0×00},// `
{0×20, 0×54, 0×54, 0×54, 0×78},// a
{0×7F, 0×48, 0×44, 0×44, 0×38},// b
{0×38, 0×44, 0×44, 0×44, 0×20},// c
{0×38, 0×44, 0×44, 0×48, 0×7F},// d
{0×38, 0×54, 0×54, 0×54, 0×18},// e
{0×08, 0×7E, 0×09, 0×01, 0×02},// f
{0×08, 0×14, 0×54, 0×54, 0×3C},// g
{0×7F, 0×08, 0×04, 0×04, 0×78},// h
{0×00, 0×44, 0×7D, 0×40, 0×00},// i
{0×20, 0×40, 0×44, 0×3D, 0×00},// j
{0×00, 0×7F, 0×10, 0×28, 0×44},// k
{0×00, 0×41, 0×7F, 0×40, 0×00},// l
{0×7C, 0×04, 0×18, 0×04, 0×78},// m
{0×7C, 0×08, 0×04, 0×04, 0×78},// n
{0×38, 0×44, 0×44, 0×44, 0×38},// o
{0×7C, 0×14, 0×14, 0×14, 0×08},// p
{0×08, 0×14, 0×14, 0×18, 0×7C},// q
{0×7C, 0×08, 0×04, 0×04, 0×08},// r
{0×48, 0×54, 0×54, 0×54, 0×20},// s
{0×04, 0×3F, 0×44, 0×40, 0×20},// t
{0×3C, 0×40, 0×40, 0×20, 0×7C},// u
{0×1C, 0×20, 0×40, 0×20, 0×1C},// v
{0×3C, 0×40, 0×30, 0×40, 0×3C},// w
{0×44, 0×28, 0×10, 0×28, 0×44},// x
{0×0C, 0×50, 0×50, 0×50, 0×3C},// y
{0×44, 0×64, 0×54, 0×4C, 0×44},// z
{0×00, 0×08, 0×36, 0×41, 0×00},// {
{0×00, 0×00, 0×7F, 0×00, 0×00},// |
{0×00, 0×41, 0×36, 0×08, 0×00},// }
{0×08, 0×08, 0×2A, 0×1C, 0×08},// →
{0×08, 0×1C, 0×2A, 0×08, 0×08}, //
{0×7F, 0×49, 0×49, 0×49, 0×30},// Б
{0×7F, 0×49, 0×49, 0×49, 0×36},// B
{0×7F, 0×01, 0×01, 0×01, 0×01},// Г
{0×60, 0×3F, 0×21, 0×3F, 0×60},// Д
{0×7F, 0×49, 0×49, 0×49, 0×41},// E
{0×63, 0×14, 0×7F, 0×14, 0×63},// Ж
{0×49, 0×49, 0×49, 0×49, 0×36},// З
{0×7F, 0×10, 0×08, 0×04, 0×7F},// И
{0×7F, 0×10, 0×09, 0×04, 0×7F},// Й
{0×7F, 0×08, 0×14, 0×22, 0×41},// К
{0×40, 0×3F, 0×01, 0×01, 0×7F},// Л
{0×7F, 0×02, 0×04, 0×02, 0×7F},// М
{0×7F, 0×08, 0×08, 0×08, 0×7F},// H
{0×3E, 0×41, 0×41, 0×41, 0×3E},// O
{0×7F, 0×01, 0×01, 0×01, 0×7F},// П
{0×7F, 0×09, 0×09, 0×09, 0×06},// P
{0×3E, 0×41, 0×41, 0×41, 0×22},// C
{0×01, 0×01, 0×7F, 0×01, 0×01},// T
{0×63, 0×14, 0×08, 0×04, 0×03},// У
{0×3E, 0×41, 0×7F, 0×41, 0×3E},// Ф
{0×63, 0×14, 0×08, 0×14, 0×63},// X
{0×3F, 0×20, 0×20, 0×3F, 0×60},// Ц
{0×07, 0×08, 0×08, 0×08, 0×7F},// Ч
{0×7F, 0×40, 0×7F, 0×40, 0×7F},// Ш
{0×3F, 0×20, 0×3F, 0×20, 0×7F},// Щ
{0×01, 0×7F, 0×48, 0×48, 0×30},// Ъ
{0×3C, 0×41, 0×42, 0×20, 0×7C},// ѝ
{0×7F, 0×08, 0×3E, 0×41, 0×3E},// Ю
{0×46, 0×29, 0×19, 0×09, 0×7F},// Я
{0×20, 0×54, 0×54, 0×54, 0×78},// а
{0×7E, 0×49, 0×45, 0×45, 0×39},// б
{0×7C, 0×54, 0×54, 0×58, 0×20},// в
{0×7C, 0×04, 0×04, 0×04, 0×04},// г
{0×08, 0×14, 0×54, 0×54, 0×3C},// д
{0×38, 0×54, 0×54, 0×54, 0×18},// е
{0×44, 0×28, 0×7C, 0×28, 0×44},// ж
{0×54, 0×54, 0×54, 0×54, 0×28},// з
{0×3C, 0×40, 0×40, 0×20, 0×7C},// и
{0×3C, 0×41, 0×42, 0×21, 0×7C},// й
{0×00, 0×7C, 0×10, 0×28, 0×44},// к
{0×40, 0×3C, 0×04, 0×04, 0×7C},// л
{0×7C, 0×08, 0×10, 0×08, 0×7C},// м
{0×00, 0×7C, 0×10, 0×10, 0×7C},// н
{0×38, 0×44, 0×44, 0×44, 0×38},// о
{0×00, 0×7C, 0×04, 0×04, 0×7C},// п
{0×7C, 0×14, 0×14, 0×14, 0×08},// р
{0×38, 0×44, 0×44, 0×44, 0×20},// с
{0×04, 0×04, 0×7C, 0×04, 0×04},// т
{0×0C, 0×50, 0×50, 0×50, 0×3C},// у
{0×38, 0×44, 0×7C, 0×44, 0×38},// ф
{0×44, 0×28, 0×10, 0×28, 0×44},// х
{0×3C, 0×20, 0×20, 0×3C, 0×60},// ц
{0×00, 0×0C, 0×10, 0×10, 0×7C},// ч
{0×7C, 0×40, 0×7C, 0×40, 0×7C},// ш
{0×3C, 0×20, 0×3C, 0×20, 0×7C},// щ
{0×04, 0×7C, 0×50, 0×50, 0×30},// ъ
{0×00, 0×7C, 0×50, 0×50, 0×30},// ь
{0×7C, 0×10, 0×38, 0×44, 0×38},// ю
{0×48, 0×34, 0×14, 0×14, 0×7C} // я
};

#define PANEL_RESET 2
#define PANEL_CLK 3
#define PANEL_D0 47
#define PANEL_D1 45
#define PANEL_D2 43
#define PANEL_D3 41
#define PANEL_D4 39
#define PANEL_D5 37
#define PANEL_D6 35

volatile uint8_t n = 0;
volatile uint8_t lines[111];

void changeN () {
n++;
PORTC = lines[n];
}

void panelInit () {
n = 0;
PORTC = 0×00;
}

void setup () {
// put your setup code here, to run once:
DDRC = 0xFF;
for (int i = 0; i < 111; i++) lines[i] = 0x00;
Serial.begin (115200);
String s = »;
while (! Serial.available ());;
s = Serial.readStringUntil ('\r');
Serial.println (s);
int index = 3;
for (int i = 0; i < s.length(); i++) {
for (int t = 0; t < 5; t++) {
lines[index] = System5×7C[s[i] — 0×20][t];
index++;
}
index += 3;
}
for (int i = 0; i < 111; i++) Serial.println(lines[i],HEX);
attachInterrupt (digitalPinToInterrupt (3), changeN, FALLING);
attachInterrupt (digitalPinToInterrupt (2), panelInit, FALLING);
}

void loop () {
// put your main code here, to run repeatedly:

}

© Habrahabr.ru