點(diǎn)陣的滾動字幕程序
“hello"滾動程序
單片機(jī)數(shù)碼管陽極接法,P0口段選,P2口位選
本文引用地址:http://butianyuan.cn/article/201611/321649.htm*********************************/
#include
#include
#define uchar unsigned char
#define uint unsigned int
uchar display[ ]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
// --H E L L O -
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
uchar shift,j=0;
void delayms(uint ms)
{
while(ms--)
for(t = 0; t < 120; t++);
}
}
void disp(void)
{
uchar i;
shift=0x7f;
for(i=8; i>0; i--)
P0=display[i+j];
P2=shift;
shift=(shift>>1)|0x80;
delayms(1);
}
void main()
{
uchar k;
P2=0xFF;
while(1)
for(j=0;j<17;j++)
{
for(k=0;k<125;k++)
disp();
}
}
}
評論