亚洲春色中文字幕久久久-三上亚,一吻二脱三床四吻胸,国产真实伦对白视频全集,在线毛片观看,精品成品入口黄网,国产毛aⅴ片久久久,亚洲AV色香蕉一区二区三区老师,萧皇后A级艳片,色情日本视频更新,99久久亚洲精品日本无码

專注電子技術學習與研究
當前位置:單片機教程網 >> MCU設計實例 >> 瀏覽文章

ASCII 8×8點陣字庫生成器

作者:佚名   來源:本站原創   點擊數:  更新時間:2012年09月05日   【字體:

這個是用來生成ASCII點陣字庫給液晶用的,在12232上測試通過。不過本程序只有倒序輸出這一種功能。

請自行下載好ASC16文件。或者發郵件到我的信箱:dv.xw@qq.com索取。BYET流量傷不起啊!

上代碼(讀取ASC16在別人的代碼上改動完成):
 

/***************************************************
 * FILE qm.c
 * Write by 萬致遠 
 * 輸出8x8字體
 * ************************************************/

#include<stdio.h>
#include<unistd.h>
#include<sys/stat.h>
#include<sys/types.h>
#include<fcntl.h>
#include<stdlib.h>
#include<errno.h>
#include<string.h>

#ifdef DEBUG
#define debug(fmt, ...) printf(fmt, #__VA_ARGS__)
#else
#define debug(fmt, ...)
#endif


void display_font_ascii(char *asc)
{
        int i, j,k=0;
	unsigned char outbuf[20];//8*8字體
        debug("=================\n");
	for(i=0;i<20;i++)
	{
		outbuf[i]=0x00;
	}
        for(i=2;i<12;i++)
        {
		if(i==9 || i == 10) continue;
                for(j=0;j<8;j++)
                {
                        /* 逐位相與,為1者打印“*”,否則打印空格 */
                        if(asc[i] & (0x80>>j))
			{
				if(i==11)
				{
					k=7;
				}
				else
				{
					k=i-2;
				}
				k=7-k;
				outbuf[j]=outbuf[j] | (0x80>>k);
				//printf("j=%d,value=0x%X,k=%d\n",j,0x80>>k,k);
			}
                        else
			{
                                //printf("0");
			}
                }
                //printf("\n");
        }
	printf("{");
	for(i=0;i<8;i++)
	{
		if(i!=7)
		{
		printf("0x%X,",outbuf[i]);
		}
		else
		{
		printf("0x%X}",outbuf[i]);
		}
	}
        debug("=================\n");
}

int main()
{
        int i;
        unsigned char *p;
        //unsigned char asciicode[] = "B";
        unsigned long offset;
        FILE *asc;
        char ascii[16];

        if((asc=fopen("ASC16","rb"))==NULL)
        {
                perror("Can't Open ASC16");
                exit(0);
        }
	printf("unsigned char __code ASCII[][8]={\n");
         /* ASCII字庫文件 */
        for (i = 32; i < 127; i++)
        {
               // debug("%c %x\n", asciicode[i], asciicode[i]); /* 打印數值 */
                offset = i*16;
                debug("offset: %x\n", offset); /* 打印偏移量 */
                fseek(asc,offset,SEEK_SET);
                fread(ascii,16,1,asc);              /* 讀取16字節 */
                display_font_ascii(ascii);        /* 顯示 */
		if(i==126)
		{
		printf("\n};");
		}
		else
		{
		printf(",\n");
		}
        }
        fclose(asc);

        return 0;
}
關閉窗口

相關文章