打印

请教一个单片机编程问题

[复制链接]
1882|5
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
saimax|  楼主 | 2012-1-3 08:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
各位电工早啊!!
    请教一个关于编程的问题:我有一个是中文字显示程序,程序的底层驱动我已经做好,即比如我向函数发送(0x111)就是待表“白”字,(0x112)代表“天”现在我想改为直接写中文发送如Dis_HZ("白天");,请问如何实现?这样程序就方便维护了!
我想到的是使用指针,但我的指针使用水平太差望大侠们指教!

相关帖子

沙发
NE5532| | 2012-1-3 09:40 | 只看该作者
写个宏好了。

使用特权

评论回复
板凳
saimax|  楼主 | 2012-1-3 09:52 | 只看该作者
写个宏???

怎样写法?

使用特权

评论回复
地板
NE5532| | 2012-1-3 12:35 | 只看该作者
你都不告诉我是用的汇编还是C,啥编译器,啥单片机,谁知道呢?

使用特权

评论回复
5
gx_huang| | 2012-1-3 16:29 | 只看该作者
这是基本功,定义一个汉字小字库,用汉字编码索引。
如果你要显示所有汉字,则需要全部字库了。

unsigned int code ChineseCode[]={
41465,  //字符:[※][1]
45288,  //字符:[拌][2]
45507,  //字符:[泵][3]
46277,  //字符:[磁][4]
46286,  //字符:[次][5]
46567,  //字符:[电][6]
47015,  //字符:[阀][7]
47348,  //字符:[隔][8]
47524,  //字符:[工][9]
48356,  //字符:[间][10]
48577,  //字符:[搅][11]
49599,  //字符:[量][12]
50155,  //字符:[秒][13]
51361,  //字符:[取][14]
51889,  //字符:[时][15]
51965,  //字符:[数][16]
53715,  //字符:[延][17]
53753,  //字符:[样][18]
54221,  //字符:[油][19]
55287   //字符:[作][20]
};

unsigned char code ChineseCharDot[]={
0x00,0x00,0x43,0x04,0x23,0x08,0x10,0x10,0x08,0x20,0x04,0x40,0x02,0x80,0x61,0x0c,0x62,0x8c,0x04,0x40,0x08,0x20,0x10,0x10,0x23,0x08,0x43,0x04,0x80,0x02,0x00,0x00,   //字符:[※][1]
0x10,0x40,0x10,0x40,0x12,0x48,0xfd,0x4c,0x11,0x50,0x13,0xfc,0x18,0x40,0x10,0x40,0x30,0x40,0xd7,0xfe,0x10,0x40,0x10,0x40,0x10,0x40,0x10,0x40,0x50,0x40,0x20,0x40,   //字符:[拌][2]
0xff,0xfe,0x02,0x00,0x04,0x00,0x0f,0xf0,0x34,0x10,0xc4,0x10,0x07,0xf0,0x01,0x00,0x7d,0x0c,0x05,0xb0,0x09,0x40,0x09,0x20,0x11,0x18,0x21,0x0e,0xc5,0x04,0x02,0x00,   //字符:[泵][3]
0x01,0x04,0xfc,0xc8,0x20,0x90,0x27,0xfe,0x20,0x88,0x40,0x88,0x79,0x08,0xc9,0x10,0x4a,0x52,0x4f,0xbc,0x49,0x08,0x4a,0x94,0x7c,0x62,0x47,0xfe,0x40,0x42,0x00,0x00,   //字符:[磁][4]
0x01,0x00,0x41,0x00,0x25,0x00,0x25,0xfe,0x2a,0x44,0x0a,0x48,0x14,0x40,0x10,0x40,0x20,0xc0,0xe0,0xa0,0x41,0x20,0x42,0x10,0x44,0x08,0x18,0x0e,0x60,0x04,0x00,0x00,   //字符:[次][5]
0x01,0x00,0x01,0x00,0x01,0x00,0x3f,0xf8,0x21,0x08,0x21,0x08,0x3f,0xf8,0x21,0x08,0x21,0x08,0x21,0x08,0x3f,0xf8,0x21,0x08,0x01,0x02,0x01,0x02,0x00,0xfe,0x00,0x00,   //字符:[电][6]
0x10,0x00,0x09,0xfc,0x08,0x04,0x22,0xc4,0x22,0xa4,0x24,0xf4,0x2f,0x84,0x34,0x94,0x24,0xa4,0x24,0xc4,0x27,0x54,0x24,0x54,0x24,0x34,0x24,0x14,0x20,0x04,0x20,0x0c,   //字符:[阀][7]
0x00,0x00,0x7b,0xfc,0x48,0x00,0x51,0xf8,0x51,0x08,0x61,0xf8,0x50,0x00,0x4f,0xfe,0x4d,0x12,0x6c,0xa2,0x55,0xfa,0x44,0x42,0x44,0x42,0x44,0x42,0x44,0x4a,0x44,0x04,   //字符:[隔][8]
0x00,0x00,0x3f,0xfc,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0xff,0xfe,0x00,0x00,0x00,0x00,   //字符:[工][9]
0x20,0x00,0x13,0xfc,0x10,0x04,0x40,0x04,0x47,0xe4,0x44,0x24,0x44,0x24,0x47,0xe4,0x44,0x24,0x44,0x24,0x47,0xe4,0x40,0x04,0x40,0x04,0x40,0x04,0x40,0x14,0x40,0x08,   //字符:[间][10]
0x10,0x00,0x10,0x44,0x11,0x24,0xfc,0xa8,0x13,0xfe,0x12,0x04,0x15,0xf8,0x19,0x08,0x31,0x48,0xd1,0x48,0x11,0x68,0x10,0xa0,0x10,0xa2,0x11,0x22,0x56,0x1e,0x20,0x00,   //字符:[搅][11]
0x1f,0xf0,0x10,0x10,0x1f,0xf0,0x10,0x10,0x1f,0xf0,0x00,0x00,0xff,0xfe,0x11,0x10,0x1f,0xf0,0x11,0x10,0x1f,0xf0,0x01,0x00,0x1f,0xf8,0x01,0x00,0xff,0xfe,0x00,0x00,   //字符:[量][12]
0x0c,0x20,0xf0,0x20,0x10,0x20,0x11,0x28,0xfd,0xa4,0x11,0x22,0x32,0x22,0x3a,0x20,0x54,0x22,0x54,0x22,0x90,0x04,0x10,0x08,0x10,0x10,0x10,0x60,0x11,0x80,0x16,0x00,   //字符:[秒][13]
0x00,0x00,0xff,0x80,0x22,0x7e,0x22,0x44,0x3e,0x44,0x22,0x44,0x22,0x44,0x3e,0x28,0x22,0x28,0x22,0x90,0x27,0x10,0x3a,0x28,0xc2,0x46,0x02,0x84,0x02,0x00,0x02,0x00,   //字符:[取][14]
0x00,0x10,0x00,0x10,0x7c,0x10,0x44,0x10,0x47,0xfe,0x44,0x10,0x7c,0x10,0x45,0x10,0x44,0x90,0x44,0x90,0x7c,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x50,0x00,0x20,   //字符:[时][15]
0x08,0x20,0x49,0x30,0x2a,0x20,0x1c,0x20,0xff,0x7e,0x1c,0x44,0x2b,0x44,0x48,0xc4,0x08,0x28,0xff,0x28,0x12,0x10,0x34,0x10,0x0c,0x28,0x32,0x4e,0xc0,0x84,0x00,0x00,   //字符:[数][16]
0x00,0x00,0xf8,0x1c,0x13,0xe0,0x10,0x20,0x20,0x20,0x79,0x20,0x29,0x3c,0x09,0x20,0x49,0x20,0x49,0x20,0x29,0xfe,0x10,0x00,0x28,0x00,0x46,0x00,0x81,0xfe,0x00,0x00,   //字符:[延][17]
0x11,0x08,0x10,0x88,0x10,0x90,0xfd,0xfe,0x10,0x20,0x30,0x20,0x39,0xfc,0x54,0x20,0x50,0x20,0x90,0x20,0x13,0xfe,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,   //字符:[样][18]
0x40,0x40,0x20,0x40,0x20,0x40,0x00,0x40,0x97,0xfc,0x54,0x44,0x54,0x44,0x14,0x44,0x24,0x44,0x27,0xfc,0xe4,0x44,0x24,0x44,0x24,0x44,0x24,0x44,0x27,0xfc,0x24,0x04,   //字符:[油][19]
0x08,0x80,0x0c,0x80,0x09,0x00,0x13,0xfe,0x12,0x80,0x34,0x88,0x50,0xfc,0x90,0x80,0x10,0x80,0x10,0x84,0x10,0xfe,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80   //字符:[作][20]
};

使用特权

评论回复
6
wangjun403| | 2012-1-3 22:05 | 只看该作者
mark

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:我就喜欢搞电子,怎么着?

28

主题

176

帖子

1

粉丝