|
#include<reg51.h>
#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
uchar oxfe;
uchar b,j,c,n=0,i=0,k=0,d=0;
void dsqcsh(void)
{
TMOD |=0x01;
TH0=0x20;
TL0=0xD1;
EA=1;
ET0=1;
TR0=1;
}
void dsqzd() interrupt 1 using 1
{
n++;
TH0=0x20;
TL0=0xD1;
if(n==2)//10ms
{
if(i!=7)
{
P2=b;
b=_crol_(b,1);//左移
n=0;
i++;}
else
{
P2=b;
b=_cror_(b,1); //右移
d++;
n=0;
if(d==7)
{i=0;
d=0;
}
}
}
}
void delay(uchar t)
{
while(t--);
}
void main()
{
dsqcsh();
b=0xfe;
while(1);
}
|
-
1.PNG
(55.52 KB, 下載次數(shù): 31)
下載附件
2020-2-19 10:31 上傳
proteus中的電路圖
|