请问一下,“20物联1班 黄珊珊 廖敏”这几个字,在keil中如何编程实现,使其显示在16x16点阵的LED显示屏上(只需要字模就好,或者哪里可以查到有关字模)
// ------------------ 汉字字模的数据结构定义 ------------------------ //
typedef struct typFNT_GB16 // 汉字字模数据结构
{
signed char Index[2]; // 汉字内码索引
char Msk[32]; // 点阵码数据
};
/////////////////////////////////////////////////////////////////////////
// 汉字字模表 //
// 汉字库: 宋体16.dot,横向取模左高位,数据排列:从左到右从上到下 //
/////////////////////////////////////////////////////////////////////////
struct typFNT_GB16 code GB_16[] = // 数据表
{
"物", 0x11,0x00,0x11,0x00,0x51,0x00,0x51,0x04,
0x7B,0xFE,0x54,0xA4,0x90,0xA4,0x1C,0xA4,
0x31,0x24,0xD1,0x44,0x12,0x44,0x12,0x44,
0x14,0x84,0x10,0x84,0x11,0x28,0x10,0x10,
"联", 0x01,0x04,0xFE,0xCC,0x24,0x50,0x24,0x00,
0x3D,0xFC,0x24,0x20,0x24,0x20,0x24,0x24,
0x3F,0xFE,0x24,0x20,0x24,0x20,0x24,0x50,
0x3E,0x50,0xE4,0x88,0x05,0x0E,0x06,0x04,
"班", 0x01,0x00,0x09,0x04,0xFD,0x7E,0x21,0x10,
0x25,0x10,0x25,0x10,0x25,0x10,0xF5,0x7C,
0x25,0x10,0x29,0x10,0x21,0x10,0x22,0x10,
0x3A,0x10,0xE2,0x14,0x44,0xFE,0x08,0x00,
"黄", 0x04,0x40,0x04,0x50,0x3F,0xF8,0x04,0x40,
0x04,0x44,0xFF,0xFE,0x01,0x10,0x1F,0xF8,
0x11,0x10,0x1F,0xF0,0x11,0x10,0x1F,0xF0,
0x10,0x00,0x04,0x60,0x18,0x18,0x60,0x04,
"珊", 0x00,0x04,0x17,0xBE,0xFC,0xA4,0x24,0xA4,
0x24,0xA4,0x24,0xA4,0xFC,0xA4,0x2F,0xFE,
0x24,0xA4,0x24,0xA4,0x3C,0xA4,0xE4,0xA4,
0x44,0xA4,0x05,0xA4,0x08,0x44,0x10,0x8C,
"廖", 0x00,0x88,0x3F,0xFC,0x20,0x00,0x3F,0x78,
0x29,0x48,0x25,0x28,0x29,0xC8,0x23,0x60,
0x2C,0x5E,0x31,0x84,0x26,0x40,0x21,0x90,
0x46,0x20,0x40,0xC0,0x83,0x00,0x0C,0x00,
"敏", 0x10,0x20,0x11,0x20,0x3F,0xA0,0x20,0x24,
0x7F,0x7E,0xA9,0x84,0x25,0x44,0x21,0x44,
0xFF,0xC8,0x29,0x28,0x45,0x28,0x41,0x10,
0x7F,0xA8,0x01,0x28,0x0A,0x46,0x04,0x84
};
// 汉字表:
// 物联班黄珊廖敏
0x00,0x00,0x7C,0xC6,0xC6,0xCE,0xD6,0xD6,0xE6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, // -0-
0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00, // -1-
0x00,0x00,0x7C,0xC6,0x06,0x0C,0x18,0x30,0x60,0xC0,0xC6,0xFE,0x00,0x00,0x00,0x00, // -2-
https://www.23bei.com/tool/965.html 可以生成字模
UCDOS中有
仅供参考:
#include <mem.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
const unsigned char bit[8]={128,64,32,16,8,4,2,1};
//--------------------------------------------------------
void dis(xoff,code)
unsigned int xoff,code;
{
unsigned char *buffer;
FILE *hzk;
unsigned long offset;
unsigned int q,w;
int x,y,width;
buffer=calloc(32,1);
if ((code&0xFF00)!=0) {
w=(code&0x00FF)-0xA1;
q=((code>>8)&0x00FF)-0xA1;
offset=q*0x5E+w;
offset*=32;
if ((hzk=fopen("HZK16","rb"))==NULL) {
closegraph();
printf("Can not open HZK16\r\n");
exit(1);
}
fseek(hzk,offset,SEEK_SET);
fread(buffer,1,32,hzk);
fclose(hzk);
width=2;
}
else {
if ((hzk=fopen("ASC16","rb"))==NULL) {
closegraph();
printf("Can not open ASC16\r\n");
exit(1);
}
offset=code*16;
fseek(hzk,offset,SEEK_SET);
fread(buffer,1,16,hzk);
fclose(hzk);
width=1;
}
for (y=0;y<16;y++) for (x=0;x<8*width;x++) {
if (buffer[y*width+x/8]&bit[x%8]) putpixel(xoff+x,y,15);
}
free(buffer);
}
//--------------------------------------------------------
void display(p)
unsigned char *p;
{
int i;
unsigned int qw;
i=0;
while (1) {
if (p[i]==0x0D||p[i]==0x1A) break;
if (p[i]>0xA0) {
qw=((unsigned int)p[i]<<8)|((unsigned int)p[i+1]&0x00FF);
dis(8*i,qw);
i+=2;
}
else {
qw=(unsigned int)p[i]&0x00FF;
dis(8*i,qw);
i++;
}
}
}
//--------------------------------------------------------
void main()
{
int gdriver = DETECT, gmode, errorcode;
long fl;
FILE *hz;
unsigned char *p;
initgraph(&gdriver, &gmode, "c:\\borlandc\\bgi");
errorcode = graphresult();
if (errorcode != grOk) {
printf("Graphics error: %s\n", grapherrormsg(errorcode));
exit(1);
}
hz=fopen("hz","rb");
fseek(hz,0,SEEK_END);
fl=ftell(hz);
p=calloc((int)fl,sizeof(unsigned char));
rewind(hz);
fread(p,1,(int)fl,hz);
fclose(hz);
display(p);
free(p);
getch();
closegraph();
}