/
点阵屏循环显示WXH
/
#include
#include
#define uchar unsigned char
#define uint unsigned int
***it DIO = P3^4;
***it S_CLR = P3^5;
***it R_CLR = P3^6;
uint k,ROW;
uint a,b;
uchar code lie[3][8]={0xFF,0xFF,0xEB,0xD5,0xB6,0xFF,0xFF,0xFF,//W
0xFF,0xBD,0xDB,0xE7,0xE7,0xDB,0xBD,0xFF,//X
0xFF,0xDB,0xDB,0xDB,0xC3,0xDB,0xDB,0xFF,//H
};
uchar code hang[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
void timerInit()
{
EA = 1;
ET0 = 1;
TR0 = 1;
TMOD = 0x01;
TH0 =0xfc;
TL0 =0x65;
}
void Send_Byte(uint z)
{
uint i;R_CLR=0;for(i=0;i<8;i++){ S_CLR=0; if(z&0x01) DIO=1; else DIO=0; z>>=1; S_CLR=1;} }
void main()
{
timerInit();
while(1);
}
void timer() interrupt 1 //5ms中断
{
TH0=0xfc;
TL0=0x65;
k++;
if(k==1000)
{
a++;
k=0;
}
Send_Byte(lie[a%3][b%8]);
Send_Byte(hang[b%8]);
b++;
R_CLR=1;
}
|