Single-chip computer applications are often used in liquid crystal display or LED lattice screen, is displayed in Dot matrix, to display Chinese characters or characters will use the type, the type is the word in the dot matrix when the corresponding encoding. To store graphics or text in the form of a type, each point requires a bit bits to store, and the bit 0 represents the pixel not displayed, and the 1 represents the display. This way, a byte can store the display of 8 pixel points.
Generally used in the song body small fourth characters to do display, such an English character just occupy 8*16 pixels, and the Chinese character needs twice times, that is, 16*16 pixel to display a Chinese character. In this way, storing an English character requires 1 bytes of storage for 8 points per line, and a total of 16 rows requires 16 bytes,
Similarly, a Chinese character requires 32
So if M is the English character from top to bottom from left to right from high to low take modulo C code 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 1 1 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 0 1 1 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 where the shape of M is drawn; If 0 is replaced by a space, the M from 1 is displayed.: C code 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Therefore, we record this bitmap by recording the value of a byte integer consisting of 0 and 1 for each row in line 16;
If the 1,2,3 line is 00000000, its value is 0, the fourth line is 11101110, and the hexadecimal representation is 0xee;
And so on, get 16 single-byte integers: 0x00,0x00,0x00,0xee,0x6c,0x6c,0x6c,0x6c,0x54,0x54,0x54,0x54,0x54,0xd6,0x00,0x00
These arrays can be computed by software, and we only need to read them through code in the SCM to show them,
The parsing process is just the opposite of encoding the data. C code #include <stdio.h> #include <stdlib.h> UNSIGNED&NBSP;CHAR&NBSP;AM[]&NBSP;=&NBSP;{0X00,0X00,0X00,0XEE,0X6C,0X6C,0X6C,0X6C,0X54,0X54,0X54,0X54,0X54, 0xd6,0x00,0x00}; //m void showm () { int i,j; unsigned char t; for (i = 0; i < 16; ++i) { //for each line t = am[i]; //out the data representing this line of points for (J&NBSP;=&NBSP;0;&NBSP;J&NBSP;<&NBSP;8;&NBSP;++J) { //for each point in this line if (0x80 & t) { //from left to right if the leftmost 1, then show printf ("MM"); }else{ printf (" "); } t <<= 1; //move the right data to the left } printf ("\ n"); } } int main (void) { showm (); return exit_success; }
However, for Chinese characters, each Chinese character has 16 pixels per line and requires 2 bytes, so each row needs to print two bytes of data, so add a for loop: C code #include < stdio.h> #include <stdlib.h> unsigned char ch[] = { /*-- text: broadcast --*/ /*-- Song Body 12; The corresponding lattice in this font is: wide x high =16x16 --*/ 0x20, 0x3c,0x27,0xc0,0x22,0x48,0xf9,0x50,0x27,0xfe,0x20,0xe0,0x29,0x50,0x32,0x4e, 0x6f,0xfc,0xa2,0x48,0x22,0x48,0x23,0xf8,0x22,0x48,0x22,0x48,0xa3,0xf8,0x42,0x08 }; void showm () { int i, j; unsigned char t, u; //represents a single Chinese character for each line ofLeft half 8 pixels and right half 8 pixels for (i = 0; i < 16; ++i ) { //for each line t = ch[i * 2]; //out the data representing this line of points u = ch[i * 2 + 1]; for (j = 0; j < 8; ++j)//print left half pixel { //for each point in this line