/////////////////////////////////////
//
// Display LED dot matrix Chinese Characters in at89s52
// Author: Yan Jianhua QQ: 10772919
// Jiangsu Nantong Technician College
// 2014.5.30
//
//////////////////////////////////////
//
Sfr P0 = 0x80;
Sfr P2 = 0xa0;
Sbit ROW0 = P2 ^ 0;
Sbit ROW1 = P2 ^ 1;
Sbit COL0 = P2 ^ 2;
Sbit COL1 = P2 ^ 3;
Sbit COL2 = P2 ^ 4;
Sbit COL3 = P2 ^ 5;
// YL-236 comes with zimo221 software, horizontal modulo, inverted byte
Unsigned char zm [] =
{
/* -- Text: vertex --*/
/* -- 12 12 12; the dot matrix corresponding to this font is: width x Height = 16x16 --*/
0x80, 0 x, 0x80, 0 x, 0x80, 0 x, 0 x, 0x80, 0x08, 0xF8, 0x1F, 0 x, 0 x, 0 x, 0 x, 0x08,
0 x, 0x08, 0xF8, 0x0F, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x,
/* -- Text: array --*/
/* -- 12 12 12; the dot matrix corresponding to this font is: width x Height = 16x16 --*/
0 x, 0x01, 0x1F, 0 x, 0x01, 0xE9, 0x3F, 0 x, 0 x, 0 x, 0 x, 0x02, 0xF1, 0x3F,
0x11, 0x02,0x15, 0x02, 0xE9, 0x7F, 0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,
};
Ys (int MS)
{
Int k, d;
For (k = 0; k }
Main ()
{
Unsigned char x, y, s, k;
While (1)
For (k = 0; k <16; k ++) // scan 16 rows from top to bottom
{
X = k/8; // k> 3. Scan the upper and lower Chinese Characters
Y = k % 8; // k & 7;, scanning 8 rows from top to bottom
P0 = 0; // It is important that the row is hidden.
ROW1 = 1; ROW1 = 0;
ROW0 = 1; ROW0 = 0;
P0 = 1 < ROW1 = x; ROW1 = 0;
ROW0 = x + 1; ROW0 = 0;
S = x * 16 + y * 2; // two bytes in each line, (y <1); half sweat words 16 bytes, x <4;
P0 = zm [s + 0]; // left half
COL0 = 1; COL0 = 0;
P0 = zm [s + 1]; // right half
COL1 = 1; COL1 = 0;
P0 = zm [s + 32 + 0]; // left half
COL2 = 1; COL2 = 0;
P0 = zm [s + 32 + 1]; // right half
COL3 = 1; COL3 = 0;
Ys (1); // flashes obviously in 1 ms
}
}
The following figure shows the simulation principle.