本帖最后由 jinglixixi 于 2017-3-29 16:04 编辑
为VEML6040环境颜色检测开发套件配上中文界面是一件有意思的事,其实现后的效果如图1所示。
图1 中文界面
为实现该效果,首先要自行构建一个小字库,如图2所示。
图2 提取字模
然后将 文件Chi.h的内容修改成如下样子:
- #define HZ_SIZE 12 //6
- extern const unsigned char CHINESE[];
- extern const unsigned int GBC_Index[];
复制代码
再按如下内容修改文件Chi.c
- #include "Chi.h"
- const unsigned int GBC_Index[]=
- {
- 2723,
- 3019,
- 4953,
- 4111,
- 2876,
- 1866,
- 3110,
- 2302,
- 4455,
- 2894,
- 1866,
- 3832,
- };
-
- const unsigned char CHINESE[]={
- //环2723
- 0x04,0x84,0x84,0xFC,0x84,0x84,0x00,0x04,0x04,0x84,0xE4,0x1C,0x84,0x04,0x04,0x00,0x20,0x60,0x20,0x1F,0x10,0x10,0x04,0x02,0x01,0x00,0xFF,0x00,0x00,0x01,0x06,0x00,
- //境3019
- 0x10,0x10,0xFF,0x10,0x10,0x20,0xA4,0xAC,0xB5,0xA6,0xB4,0xAC,0xA4,0x20,0x20,0x00,0x10,0x30,0x1F,0x08,0x88,0x80,0x4F,0x3A,0x0A,0x0A,0x7A,0x8A,0x8F,0x80,0xE0,0x00,
- //颜4953
- 0x00,0xE4,0x2C,0x35,0xA6,0x74,0x2C,0x24,0x02,0xF2,0x1A,0xD6,0x12,0xF2,0x02,0x00,0x40,0x3F,0x80,0x89,0x44,0x22,0x11,0x08,0x80,0x4F,0x30,0x0F,0x10,0x2F,0xC0,0x00,
- //色4111
- 0x20,0x10,0xE8,0x24,0x27,0x24,0x24,0xE4,0x24,0x34,0x2C,0x20,0xE0,0x00,0x00,0x00,0x00,0x00,0x3F,0x42,0x42,0x42,0x42,0x43,0x42,0x42,0x42,0x42,0x43,0x40,0x78,0x00,
- //检2876
- 0x10,0x10,0xD0,0xFF,0x90,0x50,0x20,0x50,0x4C,0x43,0x4C,0x50,0x20,0x40,0x40,0x00,0x04,0x03,0x00,0xFF,0x00,0x41,0x44,0x58,0x41,0x4E,0x60,0x58,0x47,0x40,0x40,0x00,
- //测1866
- 0x10,0x60,0x02,0x8C,0x00,0xFE,0x02,0xF2,0x02,0xFE,0x00,0xF8,0x00,0xFF,0x00,0x00,0x04,0x04,0x7E,0x01,0x80,0x47,0x30,0x0F,0x10,0x27,0x00,0x47,0x80,0x7F,0x00,0x00,
- //开3110
- 0x80,0x82,0x82,0x82,0xFE,0x82,0x82,0x82,0x82,0x82,0xFE,0x82,0x82,0x82,0x80,0x00,0x00,0x80,0x40,0x30,0x0F,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,
- //发2302
- 0x00,0x00,0x18,0x16,0x10,0xD0,0xB8,0x97,0x90,0x90,0x90,0x92,0x94,0x10,0x00,0x00,0x00,0x20,0x10,0x8C,0x83,0x80,0x41,0x46,0x28,0x10,0x28,0x44,0x43,0x80,0x80,0x00,
- //套4455
- 0x80,0x84,0x44,0x44,0x24,0xF4,0xAC,0xA7,0xAC,0xB4,0xA4,0x64,0x44,0x84,0x80,0x00,0x08,0x08,0x08,0x48,0x68,0x5F,0x4A,0x4A,0x4A,0x4A,0x4A,0x68,0xC8,0x08,0x08,0x00,
- //件2894
- 0x00,0x80,0x60,0xF8,0x07,0x80,0x60,0x1C,0x10,0x10,0xFF,0x10,0x10,0x10,0x00,0x00,0x01,0x00,0x00,0xFF,0x00,0x02,0x02,0x02,0x02,0x02,0xFF,0x02,0x02,0x02,0x02,0x00,
- //测1866
- 0x10,0x60,0x02,0x8C,0x00,0xFE,0x02,0xF2,0x02,0xFE,0x00,0xF8,0x00,0xFF,0x00,0x00,0x04,0x04,0x7E,0x01,0x80,0x47,0x30,0x0F,0x10,0x27,0x00,0x47,0x80,0x7F,0x00,0x00,
- //评3832
- 0x40,0x40,0x42,0xCC,0x00,0x00,0x12,0x62,0x02,0xFE,0x02,0x42,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x10,0x09,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x00,
- };
复制代码
最后将如下语句放入主函数main()中即可。
|