當前位置:首頁 » 編程語言 » 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,
};

熱點內容
華為高斯資料庫 發布:2025-01-25 08:55:38 瀏覽:30
php是動態語言 發布:2025-01-25 08:45:44 瀏覽:66
伺服器關閉了電腦網路還能用 發布:2025-01-25 08:22:28 瀏覽:587
熱血航線的登錄密碼在哪裡可以看 發布:2025-01-25 08:22:27 瀏覽:769
5系怎麼選擇配置 發布:2025-01-25 08:22:18 瀏覽:842
pythonscipy 發布:2025-01-25 08:18:52 瀏覽:418
恕瑞瑪伺服器地址 發布:2025-01-25 08:18:51 瀏覽:801
oa源碼php 發布:2025-01-25 08:11:31 瀏覽:734
gpc腳本 發布:2025-01-25 08:10:47 瀏覽:317
雲伺服器和伺服器的區別 發布:2025-01-25 08:10:39 瀏覽:547