📄 mk1616a.cpp
字号:
/*ACM12232 16*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("AM12232 LCD 16*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("hzk16","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)))*32 ;
fseek(fpHZK,nOffset,SEEK_SET);
for(j=0;j<32;j++)
aryHZKDot[j] =(unsigned char)getc(fpHZK) ;
nTemp = 0x80 ;
for(j=0;j<8;j++)
{
aryLCDDot[j] = ((aryHZKDot[14] & nTemp)==0?0x00:0x80) | ((aryHZKDot[12] & nTemp)==0?0x00:0x40) |
((aryHZKDot[10] & nTemp)==0?0x00:0x20) | ((aryHZKDot[8] & nTemp)==0?0x00:0x10) |
((aryHZKDot[6] & nTemp)==0?0x00:0x08) | ((aryHZKDot[4] & nTemp)==0?0x00:0x04) |
((aryHZKDot[2] & nTemp)==0?0x00:0x02) | ((aryHZKDot[0] & nTemp)==0?0x00:0x01) ;
nTemp >>= 1 ;
}
nTemp = 0x80 ;
for(j=8;j<16;j++)
{
aryLCDDot[j] = ((aryHZKDot[15] & nTemp)==0?0x00:0x80) | ((aryHZKDot[13] & nTemp)==0?0x00:0x40) |
((aryHZKDot[11] & nTemp)==0?0x00:0x20) | ((aryHZKDot[9] & nTemp)==0?0x00:0x10) |
((aryHZKDot[7] & nTemp)==0?0x00:0x08) | ((aryHZKDot[5] & nTemp)==0?0x00:0x04) |
((aryHZKDot[3] & nTemp)==0?0x00:0x02) | ((aryHZKDot[1] & nTemp)==0?0x00:0x01) ;
nTemp >>= 1 ;
}
nTemp = 0x80 ;
for(j=16;j<24;j++)
{
aryLCDDot[j] = ((aryHZKDot[30] & nTemp)==0?0x00:0x80) | ((aryHZKDot[28] & nTemp)==0?0x00:0x40) |
((aryHZKDot[26] & nTemp)==0?0x00:0x20) | ((aryHZKDot[24] & nTemp)==0?0x00:0x10) |
((aryHZKDot[22] & nTemp)==0?0x00:0x08) | ((aryHZKDot[20] & nTemp)==0?0x00:0x04) |
((aryHZKDot[18] & nTemp)==0?0x00:0x02) | ((aryHZKDot[16] & nTemp)==0?0x00:0x01) ;
nTemp >>= 1 ;
}
nTemp = 0x80 ;
for(j=24;j<32;j++)
{
aryLCDDot[j] = ((aryHZKDot[31] & nTemp)==0?0x00:0x80) | ((aryHZKDot[29] & nTemp)==0?0x00:0x40) |
((aryHZKDot[27] & nTemp)==0?0x00:0x20) | ((aryHZKDot[25] & nTemp)==0?0x00:0x10) |
((aryHZKDot[23] & nTemp)==0?0x00:0x08) | ((aryHZKDot[21] & nTemp)==0?0x00:0x04) |
((aryHZKDot[19] & nTemp)==0?0x00:0x02) | ((aryHZKDot[17] & nTemp)==0?0x00:0x01) ;
nTemp >>= 1 ;
}
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<32;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!=31) putc(',',fpDot);
putc(0x0a,fpDot);
putc(0x0d,fpDot);
}
else
putc(',',fpDot);
}
putc('}',fpDot);
putc(0x0a,fpDot);
putc(0x0d,fpDot);
}
fcloseall();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -