// -
//
// 16* 16 Dot Matrix LED Display Chinese Program
//This program displays Chinese one by one, flowing from right to left.
//Use landscape, and the traffic is only between bytes.
//Font data: The bottom of the text is stored as an odd number in the array.
//The top of the text is stored as an even number in the array.
//
// -
#i includes & ltat89s53.h & gt
# Define SEL P3 // line selection, and use the four low-order bits of P3.
# Define UP8 P0 // 8 lines IO on dot matrix text.
# Define the next 8 lines P2 // and the next 8 lines IO of dot matrix text.
Unsigned character code FontData [5][32] = {
/*-Text: Sheng-*/
/*-ì 12; The corresponding lattice of this font is: width x height = 16x 16-*/
0x00,0x80,0x 10,0xC0,0x 10,0x80,0x 10,0x88,0x 1F,0xFC,0x20,0x80,0x20,0x80,0x40,0x88,
0x9F,0xFC,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x84,0x7F,0xFE,0x00,0x00
/*-Text: Day-*/
/*-ì 12; The corresponding lattice of this font is: width x height = 16x 16-*/
0x00,0x00,0x 1F,0xF0,0x 10,0x 10,0x 10,0x 10,0x 10,0x 10,0x 10,0x 10,0x 1F,0xF0,0x 10,0x 10
0x 10,0x 10,0x 10,0x 10,0x 10,0x 10,0x 10,0x 10,0x 1F,0xF0,0x 10,0x 10,0x00,0x00,0x00,0x00,0x 00
/*-Text: Quick-*/
/*-ì 12; The corresponding lattice of this font is: width x height = 16x 16-*/
0x20,0x80,0x20,0x80,0x20,0x80,0x37,0xF8,0xA8,0x88,0xA8,0x88,0xA0,0x88,0x2F,0xFE,
0x20,0x80,0x2 1,0x40,0x2 1,0x40,0x2 1,0x20,0x22,0x 10,0x22,0x 18,0x24,0x0E,0x28,0x04
/*-Text: Le-*/
/*-ì 12; The corresponding lattice of this font is: width x height = 16x 16-*/
0x00,0x30,0x0 1,0xF8,0x 1F,0x00,0x 10,0x80,0x 10,0x80,0x 10,0x80,0x3F,0xFC,0x 10,0x80,
0x08,0x80,0x0C,0x90,0x 18,0x88,0x30,0x8C,0x24,0x86,0x42,0x84,0x0 1,0x00,0x00,0x00
}
};
Void delay _ 50 us (unsigned chart) //50 us delay program
{
Unsigned character j;
for(; t & gt0; t -)
for(j = 19; j & gt0; j -)
;
}
Void DisnFont (unsigned char * font buffer start, unsigned char n, unsigned char time)// Flows to display n Chinese characters.
{//Three parameters: the prefix address of the string, the number of words, and the displayed flow rate.
Unsigned characters FontNum, i, j, row// loop variable, word count, 16 stream, 16 column scan.
for(font num = 0; FontNum & ltn- 1; FontNum++)
{
for(I = 0; I< 16; I++)/16 moves to the left before the word-to-word flow can be completed.
{
for(j = 0; J< time; J++) // shows the delay and determines the flow rate.
{
for(row = 0; row & lt 16; Row++) // Displays the 16* 16 screen once.
{
SEL = row// Gated display column
UP8 = *(font buffer start+font num * 32+(I+row)* 2+ 1); //The key algorithm for obtaining the cyclic display data.
down 8 = *(font buffer start+font num * 32+(I+row)* 2); //Get new data according to the movement offset.
delay _ 50us( 15); //Appropriate delay
UP8 = 0x00// Turn off the monitor.
DOWN8 = 0x00// Turn off the display of the reverse screen.
}
}
}
}
}
Invalid master (invalid)
{
while( 1)
{
DisNFont (FontData[0],5,20);
}
}