📄 mk1216a.cpp
字号:
/*1815Driver汉字点阵提取程序12*16点阵*/
#include <stdio.h>
#include <string.h>
unsigned char NumToChar(unsigned char nNum)
{
if(nNum<=9)
return nNum + 48 ;
else
return nNum + 55 ;
}
void main()
{
FILE * fpHZK ;
FILE * fpDot ;
char strDotFile[12];
unsigned char strHZ[200],nTemp,nTemp1,nTemp2;
unsigned char aryHZKDot[32],aryLCDDot[32];
unsigned long nOffset;
unsigned int nLenOfHZ,i,j;
int ch;
printf("1815 LCD 12*16 DOT PRODUCER\n");
printf("Input Filename:");
scanf("%s",strDotFile);
printf("\n");
printf("Input Chinese String:");
scanf("%s",strHZ);
nLenOfHZ = strlen(strHZ) ;
printf("\n");
fpHZK = fopen("hzk12","rb") ;
fpDot = fopen(strDotFile,"wt") ;
for(i=0;i<(nLenOfHZ/2);i++)
{
nOffset = ((long)((strHZ[2*i]-0xa0-1)*94 + (strHZ[2*i+1]-0xa0-1)))*24 ;
fseek(fpHZK,nOffset,SEEK_SET);
for(j=0;j<24;j++)
{
aryHZKDot[j] =(unsigned char)getc(fpHZK) ;
aryLCDDot[j] = 0x00 ;
}
nTemp = 0x80 ;
for(j=0;j<8;j++)
{
aryLCDDot[j] = ((aryHZKDot[0] & nTemp)==0?0x00:0x04) | ((aryHZKDot[2] & nTemp)==0?0x00:0x08) |
((aryHZKDot[4] & nTemp)==0?0x00:0x10) | ((aryHZKDot[6] & nTemp)==0?0x00:0x20) |
((aryHZKDot[8] & nTemp)==0?0x00:0x40) | ((aryHZKDot[10] & nTemp)==0?0x00:0x80) ;
nTemp >>= 1 ;
}
nTemp = 0x80 ;
for(j=8;j<12;j++)
{
aryLCDDot[j] = ((aryHZKDot[1] & nTemp)==0?0x00:0x04) | ((aryHZKDot[3] & nTemp)==0?0x00:0x08) |
((aryHZKDot[5] & nTemp)==0?0x00:0x10) | ((aryHZKDot[7] & nTemp)==0?0x00:0x20) |
((aryHZKDot[9] & nTemp)==0?0x00:0x40) | ((aryHZKDot[11] & nTemp)==0?0x00:0x80) ;
nTemp >>= 1 ;
}
nTemp = 0x80 ;
for(j=12;j<20;j++)
{
aryLCDDot[j] = ((aryHZKDot[12] & nTemp)==0?0x00:0x01) | ((aryHZKDot[14] & nTemp)==0?0x00:0x02) |
((aryHZKDot[16] & nTemp)==0?0x00:0x04) | ((aryHZKDot[18] & nTemp)==0?0x00:0x08) |
((aryHZKDot[20] & nTemp)==0?0x00:0x10) | ((aryHZKDot[22] & nTemp)==0?0x00:0x20) ;
nTemp >>= 1 ;
}
nTemp = 0x80 ;
for(j=20;j<24;j++)
{
aryLCDDot[j] = ((aryHZKDot[13] & nTemp)==0?0x00:0x01) | ((aryHZKDot[15] & nTemp)==0?0x00:0x02) |
((aryHZKDot[17] & nTemp)==0?0x00:0x04) | ((aryHZKDot[19] & nTemp)==0?0x00:0x08) |
((aryHZKDot[21] & nTemp)==0?0x00:0x10) | ((aryHZKDot[23] & nTemp)==0?0x00:0x20) ;
nTemp >>= 1 ;
}
putc('/',fpDot);
putc('/',fpDot);
putc(strHZ[2*i],fpDot) ;
putc(strHZ[2*i+1],fpDot) ;
putc(0x0a,fpDot);
// putc(0x0d,fpDot);
putc('{',fpDot);
// putc(0x0a,fpDot);
// putc(0x0d,fpDot);
for(j=0;j<24;j++)
{
nTemp1 = NumToChar((aryLCDDot[j] & 0xf0)>>4) ;
nTemp2 = NumToChar(aryLCDDot[j] & 0x0f) ;
putc('0',fpDot);
putc('x',fpDot);
putc(nTemp1,fpDot);
putc(nTemp2,fpDot);
/*
if((j+1)%8==0)
{
if(j!=23) putc(',',fpDot);
putc(0x0a,fpDot);
putc(0x0d,fpDot);
}
else
putc(',',fpDot);
*/
if(j!=23) putc(',',fpDot);
}
putc('}',fpDot);
putc(',',fpDot);
putc(0x0a,fpDot);
// putc(0x0d,fpDot);
}
fcloseall();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -