c語言88點陣
⑴ 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,
};