本帖最后由 eehome 于 2013-1-5 10:06 编辑
#include
#define uchar unsigned char
#define uint unsigned int
uchar C_cross[8]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
uchar R_cross[10][8]={
{0x00,0x42,0x46,0x4a,0x52,0x62,0x42,0x00},//"Z"
{0x00,0x40,0x40,0x7e,0x40,0x40,0x00,0x00},//"T"
{0x7e,0x20,0x10,0x08,0x10,0x20,0x7e,0x00},//"M"
{0x00,0x42,0x42,0x7e,0x42,0x42,0x00,0x00},//"I"
{0x30,0x48,0x44,0x32,0x44,0x48,0x30,0x00},//"LOVE"
{0x00,0x80,0x40,0x3e,0x40,0x80,0x00,0x00}, //"Y"
{0x30,0x28,0x14,0x38,0x38,0x14,0x28,0x30},//"LOVE,LOVE"
{0x00,0x80,0x40,0x3e,0x40,0x80,0x00,0x00}, //"Y"
{0x00,0x20,0x20,0x1e,0x10,0x20,0x20,0x00}, //"R"
{0x00,0x7e,0x42,0x42,0x42,0x24,0x18,0x00} //"D"
};
uchar offset;
uchar n;
void Delayms(uchar mt)
{
uchar t;
for(mt;mt>0;mt--)
for(t=110;t>0;t--);
}
void main(void)
{
uchar i;
uchar *p;
n=0;
TMOD=0x01;
TH0=0xfc;
TL0=0x18;
ET0=1;
EA=1;
TR0=1;
p=&R_cross[0][0];
while(1)
{
for(i=0;i<8;i++)
{
Delayms(10000);
P0=*(p+offset);
P2=C_cross;
p++;
if(p>&R_cross[0][7])
p=&R_cross[0][0];
}
}
}
void timer0() interrupt 1 using 3
{
TF0=0;
TH0=0xfc;
TL0=0xe18;
if(n<200)
{
n++;
}
else
{
n=0;
offset+=1;
if(offset>72)
offset=0;
}
}
|