当前位置:首页 » 编程语言 » 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,
};

热点内容
c语言期中 发布:2025-04-03 15:07:39 浏览:18
sql建立关系 发布:2025-04-03 15:02:32 浏览:638
10万左右的服务器电脑 发布:2025-04-03 14:58:39 浏览:135
oracle数据库库名 发布:2025-04-03 14:57:26 浏览:296
c语言紫皮 发布:2025-04-03 14:38:22 浏览:857
华为路由存储 发布:2025-04-03 14:36:55 浏览:206
虚拟服务器地址 发布:2025-04-03 14:36:53 浏览:619
家用垃圾压缩机 发布:2025-04-03 14:36:52 浏览:418
计算存储解耦 发布:2025-04-03 14:28:17 浏览:277
编译器能够识别的语义 发布:2025-04-03 14:23:43 浏览:370