#include<reg51.h>
sbit DIR=P0^0;
sbit DIR_=P0^1;
sbit M1=P3^6;
sbit M2=P3^7;
void delay(unsigned int i)
{
while(i--);
}
void main()
{
while(1)
{
if(!DIR)
{
M1=0;
M2=1;
delay(20);
M1=1;
M2=1;
delay(2);
}
if(!DIR_)
{
M1=1;
M2=0;
delay(1);
M1=1;
M2=1;
delay(1);
}
}
}

单片机的编程语言设计与应用
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-