#include "reg52.h"
#include "intrins.h"
#define uchar unsigned char
#define uint unsigned int
sbit IN1=P1^1;
sbit IN2=P1^2;
sbit IN3=P1^3;
sbit IN4=P1^4;
sbit ENA=P1^0;
void delay(unsigned int z)
{
unsigned int x,y;
for(x=z;x>0;x--)
for(y=100;y>0;y--);
}
void main()
{
while(1)
{
unsigned int i;
IN1=0;
IN2=1;
IN3=1;
IN4=0; //正转反转
for(i=0;i<100;i++)
{
delay(20);
}
IN1=1;
IN2=0;
IN3=0;
IN4=1; //反转正转
for(i=0;i<100;i++)
{
delay(20);
}
IN1=1;
IN2=0;
IN3=1;
IN4=0; //反转反转
for(i=0;i<100;i++)
{
delay(20);
}
IN1=0;
IN2=1;
IN3=0;
IN4=1; //正转正转
for(i=0;i<100;i++)
{
delay(20);
}
}
}
|