#include<reg52.h>
#include<intrins.h>
#define data P2
#define uint unsigned int
void delay10ms(void);
void delay500ms(void);
void found(void);
void initEx0(void);
sbit start_signal = P1^2;
sbit stop_singal = P1^3;
sbit up_to_down = P1^4;
sbit down_to_up = P1^5;
sbit inter_signal = P3^2;
uint fp = 1;
int main()
{
initEx0();
while(1)
{
if(!(start_signal && stop_singal && up_to_down && down_to_up))
{
delay10ms();
if(!(start_signal && stop_singal && up_to_down && down_to_up))
{
inter_signal = 0;
}
}
switch(fp)
{
case 0:data = 0x01;delay500ms();while(1){data = _crol_(data,1);delay500ms();if(!(start_signal && stop_singal && up_to_down && down_to_up))break;}break;
case 1:data = 0x00;break;
case 2:while(1){data = data = _crol_(data,1);delay500ms();if(!(start_signal && stop_singal && up_to_down && down_to_up))break;}break;
case 3:while(1){data = data = _cror_(data,1);delay500ms();if(!(start_signal && stop_singal && up_to_down && down_to_up))break;}break;
default:data = 0x00;break;
}
}
return 0;
}
void delay10ms(void)
{
unsigned char a,b,c;
for(c=1;c>0;c--)
for(b=38;b>0;b--)
for(a=130;a>0;a--);
}
void delay500ms(void)
{
unsigned char a,b,c;
for(c=23;c>0;c--)
for(b=152;b>0;b--)
for(a=70;a>0;a--);
}
void found(void)
{
if(start_signal == 0)
{
delay10ms();
if(start_signal == 0)
{
while(!start_signal);
fp = 0;
}
}
if(stop_singal == 0)
{
delay10ms();
if(stop_singal == 0)
{
while(!stop_singal);
fp = 1;
}
}
if(up_to_down == 0)
{
delay10ms();
if(up_to_down == 0)
{
while(!up_to_down);
fp = 2;
}
}
if(down_to_up == 0)
{
delay10ms();
if(down_to_up == 0)
{
while(!down_to_up);
fp = 3;
}
}
while(!(start_signal && stop_singal && up_to_down && down_to_up));
}
void initEx0()
{
EA = 1;
EX0 = 1;
IT0 = 1;
}
void Ex0_intr() interrupt 0
{
found();
inter_signal = 1;
}
没有合适的资源?快使用搜索试试~ 我知道了~
键盘控制流水灯(protuse+C)
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共4个文件
workspace:1个
pdsprj:1个
zip:1个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
需积分: 7 0 下载量 22 浏览量
2022-11-27
14:42:37
上传
评论
收藏 30.9MB ZIP 举报
温馨提示
键盘控制流水灯(protuse+C)
资源推荐
资源详情
资源评论
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/ZIP.png)
共 4 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/d18e7bc6c0024a7c9132bc61fbb8ca48_fristplayer.jpg!1)
GLY_2002
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)