admin 管理员组

文章数量: 887007

9.80c51转向灯及proteus仿真实验

proteus仿真电路图

代码实现部分

#include"reg52.h"typedef unsigned char u8;
typedef unsigned int u16;sbit k1=P1^0;
sbit k2=P1^1;
sbit led1=P1^2;
sbit led2=P1^3;
sbit led3=P1^4;
sbit led4=P1^5;void delay(u16 i)
{while(i--);
}void Zhuanxiang()
{if(k1==0){while(1){led1=0;led2=0;delay(40000);led1=1;led2=1;delay(40000);if(k1!=0)break;}}if(k2==0){while(1){led3=0;led4=0;delay(40000);led3=1;led4=1;delay(40000);if(k2!=0)break;}}
}
main()
{while(1){Zhuanxiang();}
}

本文标签: 980c51转向灯及proteus仿真实验