点阵如何左移一列一列显示啊?我给个翻滚显示的,帮我改改看
用3块595驱动8x8点阵,一块空公共端,两块控双色,595的定义不用改,改主程序和加变量
#include
#include
***it sen1=P2^0;
***it slk1=P2^1; //hang
***it sc1=P2^2;
***it sen2=P1^0;
***it slk2=P1^1; //lie
***it sc2=P1^2;
unsigned char code hangma[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char code liema[]={0x81,0x81,0xe7,0xe7,0xe7,0xe7,0x81,0x81};//,0x00,0x36,0x49,0x41,0x22,0x14,0x08,0x00,0x00,0x41,0x41,0x41,0x41,0x22,0x16,0x08} ;
void lie(unsigned char dat)
{
unsigned char i;
for(i=0;i<8;i++)
{
sen1=dat&0x80;
dat<<=1;
slk1=1;
_nop_();
slk1=0;
}
sc1=1;
_nop_();
sc1=0;
}
void hang(unsigned char dat)
{
unsigned char i;
for(i=0;i<8;i++)
{
sen2=dat&0x80;
dat<<=1;
slk2=1;
_nop_();
slk2=0;
}
}
void hang2(unsigned char dat1,unsigned char dat2)
{
hang(dat1);
hang(dat2);
}
void out(void)
{
sc2=1;
_nop_();
sc2=0;
}
void delus(unsigned char t)
{
while(--t);
}
void delms(unsigned char t)
{
while(t--)
{
delus(245);
delus(245);
}
}
void main()
{
unsigned char i;
while(1)
{
for(i=0;i<8;i++)
{
for(i=0;i<8;i++)
{
lie(~liema[i]);
hang2(hangma[i],0xff);
out();
delms(1);
hang2(0xff,0xff);
out();
}
}
}
}
0
|