?? liushui.c
字號:
#include <reg52.h>
#include <intrins.h>
//unsigned char a,b,k,j;
unsigned char count,temp,a,b;
//sbit beep=P2^3;
sbit BY1=P3^5;
void delay10ms()
{
unsigned char i,j;
for(i=20;i>0;i--)
for(j=248;j>0;j--);
}
void key()
{
if(BY1==0)
{
delay10ms();
if(BY1==0)
{
count++;
if(count==8)
{
count=0;
}
}
while(BY1==0);
}
}
void move()
{
a=temp<<count;
b=temp>>(8-count);
P1=a|b;//循環(huán)左移count位,0~7
}
void main()
{
count=0;
temp=0xfe;
//P1=0xff;
P1=temp;
while(1)
{
key();
move();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -