问题描述:
这是给出的相关的材料,请教达人指点啊
我不知道如何动手,也不清楚代码要怎么写
希望高手给编写出来吧.谢谢了
/* Chars are defined as 5 columns with each 8 bit, (5x8 font)
lowest 4 dots up to down 1,2,4,8 is higher nibble,
upper 4 dots up to down is lower nibble, for example:
| 123456
-+----------
|
1| xxx 1
2| x x 2
3| x x 4
4| x x __8 "A" is {0x7E,0x11,0x11,0x11,0x7E,0x00} (Last column blank)
5| xxxxx 1
6| x x 2
7| x x 4
8| 8
*/
const byte prime_char_map[][6] = { {0x00,0x00,0x00,0x00,0x00,0x00}, \
/* Block for test at startup */ {0xFF,0xFF,0xFF,0xFF,0xFF,0x00}, \
/* 02 */ {0x00,0x00,0x00,0x00,0x00,0x00}, \
/* 03 */ {0x00,0x00,0x00,0x00,0x00,0x00}, \
/* 04 */ {0x00,0x00,0x00,0x00,0x00,0x00}, \
/* 05 */ {0x00,0x00,0x00,0x00,0x00,0x00}, \
/* 06 */ {0x00,0x00,0x00,0x00,0x00,0x00}, \
/* 07 */ {0x00,0x00,0x00,0x00,0x00,0x00}, \
/* 08 */ {0x00,0x00,0x00,0x00,0x00,0x00}, \
/* 09 */ {0x00,0x00,0x00,0x00,0x00,0x00}, \
/* 0A */ {0x00,0x00,0x00,0x00,0x00,0x00}, \
/* 0B */ {0x00,0x00,0x00,0x00,0x00,0x00}, \
/* 0C */ {0x00,0x00,0x00,0x00,0x00,0x00}, \
/* 0D */ {0x00,0x00,0x00,0x00,0x00,0x00}, \
/* 0E */ {0x00,0x00,0x00,0x00,0x00,0x00}, \
/* 0F */ {0x00,0x00,0x00,0x00,0x00,0x00}, \
/* 10 */ {0x00,0x7F,0x3E,0x1C,0x08,0x00}, \
/* 11 */ {0x08,0x1C,0x3E,0x7F,0x00,0x00}, \
/* 12 */ {0x44,0x66,0x77,0x66,0x44,0x00}, \
/* 13 */ {0x11,0x33,0x77,0x33,0x11,0x00}, \
/* 14 */ {0x48,0x77,0x49,0x41,0x42,0x00}, \
/* 15 */ {0x30,0x48,0x45,0x40,0x20,0x00}, \
/* 16 */ {0x00,0x00,0x7D,0x00,0x00,0x00}, \
/* 17 */ {0x40,0xE0,0xE0,0x7F,0x06,0x00}, \
/* 18 */ {0x24,0x42,0x81,0x42,0x24,0x00}, \
/* 19 */ {0x0F,0xF0,0x00,0xF0,0x0F,0x00}, \
/* 1A */ {0x20,0x40,0x20,0x10,0x08,0x00}, \
/* 1B */ {0x7C,0x82,0x82,0x83,0x44,0x00}, \
/* 1C */
解析:
你的材料不全吧,看样子应该是prime_char_map[][6]第一维应该有256个元素的,你给出来的只是前面的一小部分,这里面很多都不是可显示的字符。下面是根据你的材料写的显示字符的程序:#include <stdio.h>const byte prime_char_map[][6] = {{0x00,0x00,0x00,0x00,0x00,0x00}}这个地方你得把你的材料里的prime_char_map定义全都粘进来void Display(char c)void main(){Display('A')Display('b')}void Display(char c){int i, jbyte bit = 0x01for (i = 0i <8i++){for (j = 0j <6j++){if (prime_char_map[c][j] &bit)printf("x")elseprintf(" ")}printf("\n")bit *= 2}}
常用的点阵规格为8*8或16*16等,9*9点阵显示比较麻烦。9*9点阵组成的字符A可显示在16*16点阵上,当然用点阵型液晶屏也可显示9*9点阵组成的字符。方法,先取模,字模按9行*16列取,占用9*2=18个字节。编号0 1........17,其中1 3 5 7..........17这9个字节中只有1位有效。因此写程序时,0 2 4等双数字节可显示8个点,1 3 5 7等单数字节只显示1个点。 程序就比较简单 ,对每个字节逐位判断是0还是1,是1画点,是0不显示。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)