點陣16*32綜合C程序
具體視頻效果祥見:http://www.tudou.com/programs/view/8qoTrWwtGzg/
本文引用地址:http://www.ex-cimer.com/article/201611/323401.htm程序代碼下載:http://www.51hei.com/f/dz88.rar
#include
#define uchar unsigned char
#define uint unsigned int
#define LINE P0//定義行線IO口,即74HC154控制端
#define shudu 4//字移動的速度
sbit DATA=P1^4;//74HC595數(shù)據(jù)端
sbit CLK=P1^5;//74HC595移位脈沖端
sbit CLKR=P1^6;//74HC595數(shù)據(jù)鎖存端
uchar move;//移動幾位變量
uchar line,ji;//行變量
uint word;//字節(jié)變量
uchar BUF[6];//4組緩存數(shù)組以便動態(tài)更改數(shù)據(jù)
uchar code table[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x10,0x3F,0xF8,0x04,0x10,0x04,0x14,0xFF,0xFE,0x04,0x10,0x04,0x10,
0x3F,0xF0,0x04,0x10,0x04,0x00,0x08,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,
0x01,0x00,0x01,0x08,0x7F,0xFC,0x01,0x00,0x3F,0xF8,0x01,0x00,0xFF,0xFE,0x00,0x10,
0x1F,0xF8,0x10,0x10,0x1F,0xF0,0x10,0x10,0x1F,0xF0,0x10,0x10,0x10,0x50,0x10,0x20,
0x01,0x00,0x01,0x00,0x01,0xF8,0x01,0x00,0x01,0x10,0x1F,0xF8,0x10,0x10,0x10,0x10,
0x10,0x10,0x1F,0xF0,0x10,0x10,0x01,0x10,0x28,0x88,0x24,0x44,0x44,0x44,0x00,0x00,
0x00,0x80,0xF8,0x80,0x88,0x80,0x97,0xFC,0xA1,0x00,0x91,0x40,0x8A,0x40,0x8F,0xFC,
0x88,0x40,0xA8,0x40,0x97,0xFE,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,0x80,0x40,
0x24,0x04,0x34,0x04,0x24,0x24,0x3F,0xA4,0x44,0x24,0x04,0x24,0x7F,0xA4,0x04,0x24,
0x3F,0xA4,0x24,0xA4,0x24,0xA4,0x24,0xA4,0x24,0x84,0x27,0x84,0x05,0x14,0x04,0x08,
0x08,0x80,0x0C,0x80,0x09,0x00,0x13,0xFE,0x12,0x80,0x34,0x88,0x50,0xFC,0x90,0x80,
0x10,0x80,0x10,0x84,0x10,0xFE,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,
0x00,0xA0,0x00,0x90,0x00,0x80,0x3F,0xFE,0x20,0x80,0x20,0x80,0x3E,0x88,0x22,0x8C,
0x22,0x48,0x22,0x50,0x22,0x20,0x2A,0x60,0x44,0x92,0x41,0x0A,0x86,0x06,0x00,0x02,
0x00,0x20,0x00,0x20,0x7F,0x20,0x08,0x20,0x0B,0xFC,0x08,0x24,0x08,0x24,0x08,0x44,
0x09,0x44,0x0E,0x44,0xF0,0x84,0x40,0x84,0x01,0x04,0x02,0x78,0x04,0x10,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};//字模數(shù)組
ucharcode table1[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/* 當(dāng)前所選字體下一個漢字對應(yīng)的點陣為: 寬度x高度=32x16, 調(diào)整后為: 32x16*/
0x00,0x00,0x01,0x00,0x3F,0xF8,0x01,0x00,0x02,0x08,0x3F,0xF8,0x02,0x08,0x01,0x00,
0x7F,0xFE,0x1F,0xF0,0x02,0x08,0x01,0x00,0x02,0x08,0xFF,0xFE,0x3F,0xF8,0x00,0x00,
0x02,0x08,0x1F,0xF0,0x02,0x00,0x10,0x10,0x04,0x00,0x1F,0xF0,0x04,0x00,0x10,0x10,
0x08,0x00,0x1F,0xF0,0x10,0x00,0x10,0x10,0x20,0x00,0x10,0x50,0x40,0x00,0x10,0x20,
/*; 當(dāng)前所選字體下一個漢字對應(yīng)的點陣為: 寬度x高度=32x16, 調(diào)整后為: 32x16*/
0x01,0x00,0x00,0x80,0x01,0x00,0xF8,0x80,0x01,0xF8,0x88,0x80,0x01,0x00,0x97,0xFC,
0x01,0x10,0xA1,0x00,0x1F,0xF8,0x91,0x40,0x10,0x10,0x8A,0x40,0x10,0x10,0x8F,0xFC,
0x10,0x10,0x88,0x40,0x1F,0xF0,0xA8,0x40,0x10,0x10,0x97,0xFE,0x01,0x10,0x80,0x40,
0x28,0x88,0x80,0x40,0x24,0x44,0x80,0x40,0x44,0x44,0x80,0x40,0x00,0x00,0x80,0x40,
/*; 當(dāng)前所選字體下一個漢字對應(yīng)的點陣為: 寬度x高度=32x16, 調(diào)整后為: 32x16*/
0x24,0x04,0x08,0x80,0x34,0x04,0x0C,0x80,0x24,0x24,0x09,0x00,0x3F,0xA4,0x13,0xFE,
0x44,0x24,0x12,0x80,0x04,0x24,0x34,0x88,0x7F,0xA4,0x50,0xFC,0x04,0x24,0x90,0x80,
0x3F,0xA4,0x10,0x80,0x24,0xA4,0x10,0x84,0x24,0xA4,0x10,0xFE,0x24,0xA4,0x10,0x80,
0x24,0x84,0x10,0x80,0x27,0x84,0x10,0x80,0x05,0x14,0x10,0x80,0x04,0x08,0x10,0x80,
/*; 當(dāng)前所選字體下一個漢字對應(yīng)的點陣為: 寬度x高度=32x16, 調(diào)整后為: 32x16*/
0x00,0xA0,0x00,0x20,0x00,0x90,0x00,0x20,0x00,0x80,0x7F,0x20,0x3F,0xFE,0x08,0x20,
0x20,0x80,0x0B,0xFC,0x20,0x80,0x08,0x24,0x3E,0x88,0x08,0x24,0x22,0x8C,0x08,0x44,
0x22,0x48,0x09,0x44,0x22,0x50,0x0E,0x44,0x22,0x20,0xF0,0x84,0x2A,0x60,0x40,0x84,
0x44,0x92,0x01,0x04,0x41,0x0A,0x02,0x78,0x86,0x06,0x04,0x10,0x00,0x02,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
ucharcode table2[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*; 當(dāng)前所選字體下一個漢字對應(yīng)的點陣為: 寬度x高度=32x16, 調(diào)整后為: 32x16*/
0x00,0xA0,0x00,0x20,0x00,0x90,0x00,0x20,0x00,0x80,0x7F,0x20,0x3F,0xFE,0x08,0x20,
0x20,0x80,0x0B,0xFC,0x20,0x80,0x08,0x24,0x3E,0x88,0x08,0x24,0x22,0x8C,0x08,0x44,
0x22,0x48,0x09,0x44,0x22,0x50,0x0E,0x44,0x22,0x20,0xF0,0x84,0x2A,0x60,0x40,0x84,
0x44,0x92,0x01,0x04,0x41,0x0A,0x02,0x78,0x86,0x06,0x04,0x10,0x00,0x02,0x00,0x00,
/*; 當(dāng)前所選字體下一個漢字對應(yīng)的點陣為: 寬度x高度=32x16, 調(diào)整后為: 32x16*/
0x24,0x04,0x08,0x80,0x34,0x04,0x0C,0x80,0x24,0x24,0x09,0x00,0x3F,0xA4,0x13,0xFE,
0x44,0x24,0x12,0x80,0x04,0x24,0x34,0x88,0x7F,0xA4,0x50,0xFC,0x04,0x24,0x90,0x80,
0x3F,0xA4,0x10,0x80,0x24,0xA4,0x10,0x84,0x24,0xA4,0x10,0xFE,0x24,0xA4,0x10,0x80,
0x24,0x84,0x10,0x80,0x27,0x84,0x10,0x80,0x05,0x14,0x10,0x80,0x04,0x08,0x10,0x80,
/*; 當(dāng)前所選字體下一個漢字對應(yīng)的點陣為: 寬度x高度=32x16, 調(diào)整后為: 32x16*/
0x01,0x00,0x00,0x80,0x01,0x00,0xF8,0x80,0x01,0xF8,0x88,0x80,0x01,0x00,0x97,0xFC,
0x01,0x10,0xA1,0x00,0x1F,0xF8,0x91,0x40,0x10,0x10,0x8A,0x40,0x10,0x10,0x8F,0xFC,
0x10,0x10,0x88,0x40,0x1F,0xF0,0xA8,0x40,0x10,0x10,0x97,0xFE,0x01,0x10,0x80,0x40,
0x28,0x88,0x80,0x40,0x24,0x44,0x80,0x40,0x44,0x44,0x80,0x40,0x00,0x00,0x80,0x40,
/* 當(dāng)前所選字體下一個漢字對應(yīng)的點陣為: 寬度x高度=32x16, 調(diào)整后為: 32x16*/
0x00,0x00,0x01,0x00,0x3F,0xF8,0x01,0x00,0x02,0x08,0x3F,0xF8,0x02,0x08,0x01,0x00,
0x7F,0xFE,0x1F,0xF0,0x02,0x08,0x01,0x00,0x02,0x08,0xFF,0xFE,0x3F,0xF8,0x00,0x00,
0x02,0x08,0x1F,0xF0,0x02,0x00,0x10,0x10,0x04,0x00,0x1F,0xF0,0x04,0x00,0x10,0x10,
0x08,0x00,0x1F,0xF0,0x10,0x00,0x10,0x10,0x20,0x00,0x10,0x50,0x40,0x00,0x10,0x20,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/******************************************/
/***************延時子程序*****************/
/******************************************/
void delay(uchar z)
{
uchar x,y;
for(x=8;x>0;x--)
for(y=z;y>0;y--);
}
/********************************/
/**74HC595移位寄存器送數(shù)子函數(shù)***/
/********************************/
void song(uchar z)//帶參數(shù)函數(shù)
{
uchar num,hang;//定義變量
hang=z;//將形參給變量
for(num=0;num<8;num++)//移動8次將數(shù)據(jù)發(fā)送完畢
{
if(hang&0x01==1)//將高7位屏蔽掉,保留最低位判斷
DATA=1;//為1就將74HC595數(shù)據(jù)端置1
else
DATA=0;//否則給0
CLK=0;//上升沿送走數(shù)據(jù)
CLK=1;//高電平形成上升沿
hang>>=1;//將數(shù)移走一位
}
}
評論