当前位置:首页 » 编程语言 » c语言88点阵

c语言88点阵

发布时间: 2023-11-29 11:34:46

⑴ 8*8双色点阵怎么用,c语言代码怎么写

1、8*8双色点阵实际上是两个8*8点阵,必须增加一个端口来控制是使用哪个颜色的8*8点阵;或者连接成一个8*16点阵来控制。C语言代码和控制8*8点阵类似,增加扫描端口就可以了。

2、例程:

#include<reg51.h>
unsignedcharcodetab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsignedcharcodedigittab[10][8]={
{0x00,0x00,0x3e,0x41,0x41,0x41,0x3e,0x00},//0
{0x00,0x00,0x00,0x00,0x21,0x7f,0x01,0x00},//1
{0x00,0x00,0x27,0x45,0x45,0x45,0x39,0x00},//2
{0x00,0x00,0x22,0x49,0x49,0x49,0x36,0x00},//3
{0x00,0x00,0x0c,0x14,0x24,0x7f,0x04,0x00},//4
{0x00,0x00,0x72,0x51,0x51,0x51,0x4e,0x00},//5
{0x00,0x00,0x3e,0x49,0x49,0x49,0x26,0x00},//6
{0x00,0x00,0x40,0x40,0x40,0x4f,0x70,0x00},//7
{0x00,0x00,0x36,0x49,0x49,0x49,0x36,0x00},//8
{0x00,0x00,0x32,0x49,0x49,0x49,0x3e,0x00}//9
};

unsignedinttimecount;
unsignedcharcnta;
unsignedcharcntb;

voidmain(void)
{
TMOD=0x01;
TH0=(65536-1000)/256;
TL0=(65536-1000)%256;
TR0=1;
ET0=1;
EA=1;
while(1)
{;
}
}

voidt0(void)interrupt1using0
{
TH0=(65536-1000)/256;
TL0=(65536-1000)%256;
P3=tab[cnta];
P1=digittab[cntb][cnta];
cnta++;
if(cnta==8)
{
cnta=0;
}
timecount++;
if(timecount==333)
{
timecount=0;
cntb++;
if(cntb==10)
{
cntb=0;
}
}
}

⑵ c语言字模问题

void drawmat(char *mat,int matsize,int x,int y,int color)
/*依次:字模指针、点阵大小、起始坐标(x,y)、颜色*/
{int i,j,k,n;
n=(matsize-1)/8+1;//n是点阵的列数
for(j=0;j<matsize;j++)//j代表点阵中第j行的字符意思
for(i=0;i<n;i++)//i代表点阵中第i列字符的意思
for(k=0;k<8;k++)//k代表在当前字模中,第k位的值
if(mat[j*n+i]&(0x80>>k)) /*测试为1的位则显示*/
putpixel(x+i*8+k,y+j,color);
}

你把字模的每个矩阵元素用二进制展开就知道k的意思了:
char shan16[]={
/* 以下是 '山' 的 16点阵宋体 字模,32 byte */
0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,
0x01,0x00,0x01,0x00,0x01,0x08,0x21,0x08,
0x21,0x08,0x21,0x08,0x21,0xF8,0x2E,0x08,
0x30,0x08,0x00,0x00,0x00,0x00,0x00,0x00,

};
相当于:
0000 0000 0000 0000 0000 0001 0000 0000
0000 0001 0000 0000 0000 0001 0000 0000
0000 0001 0000 0000 0000 0001 0000 0000
0000 0001 0000 1000 0010 0001 0000 1000
0010 0001 0000 1000 0010 0001 0000 1000
0010 0001 1111 1000 0010 1110 0000 1000
0011 0000 0000 1000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
最后得到:
_______________8________________
___________8___8________________
___________8___8________________
______8____8___8________8___8___
__8___8____8___8________8___8___
__8___8____8888_8888____8___8___
__88____________________8_______
________________________________

⑶ 急!!C语言编写 汉字点阵字库

/* 以下是 '谢' 的 16点阵宋体 字模,32 byte */
0x01,0x08,0x42,0x08,0x37,0x88,0x24,0x88,
0x07,0xFE,0x04,0x88,0xE7,0xC8,0x24,0xA8,
0x2F,0xA8,0x21,0x88,0x22,0x88,0x2A,0x88,
0x34,0x88,0x28,0x88,0x12,0xA8,0x01,0x10,
};
/* 以下是 '佳' 的 16点阵宋体 字模,32 byte */
0x08,0x40,0x0C,0x40,0x18,0x48,0x17,0xFC,
0x30,0x40,0x60,0x44,0xAF,0xFE,0x20,0x40,
0x20,0x40,0x20,0x48,0x27,0xFC,0x20,0x40,
0x20,0x40,0x20,0x44,0x2F,0xFE,0x20,0x00,
};

/* 以下是 '志' 的 16点阵宋体 字模,32 byte */
0x01,0x00,0x01,0x00,0x01,0x00,0x7F,0xFE,
0x01,0x00,0x01,0x00,0x3F,0xFC,0x00,0x00,
0x01,0x00,0x08,0x88,0x48,0xC4,0x48,0x86,
0x48,0x14,0x88,0x18,0x07,0xF0,0x00,0x00,
};

热点内容
php取文本框值 发布:2025-01-25 05:08:50 浏览:245
怎么查看服务器状态 发布:2025-01-25 05:08:42 浏览:716
win7无法访问xp共享打印机 发布:2025-01-25 05:05:04 浏览:806
编程刷分 发布:2025-01-25 04:55:07 浏览:631
世界服务密码是多少 发布:2025-01-25 04:42:52 浏览:48
专车配置有哪些 发布:2025-01-25 04:42:46 浏览:570
java培训班收费 发布:2025-01-25 04:37:53 浏览:767
密码锁如何密码解锁 发布:2025-01-25 04:25:16 浏览:385
ebay如何上传产品 发布:2025-01-25 04:04:37 浏览:824
java判断是否手机访问权限 发布:2025-01-25 04:02:28 浏览:807