#include
////////////电机转动
sbit P30=P2^0;
sbit P31=P2^1;
sbit P32=P2^2;
sbit P33=P2^3;
/////////pwm调试使能端
sbit ENA=P0^0;
sbit ENB=P0^1;
////////////四路循迹
sbit P10=P1^7;
sbit P11=P1^6;
sbit P12=P1^5;
sbit P13=P1^4;
////////////////
#define Right_moto_pwm P0^0 //接驱动模块ENA使能端输入PWM信号调节速度
void delay(unsigned int t); //函数声明
#define Left_moto_pwm P0^1 //接驱动模块ENB使能端输入PWM信号调节速度
void Init_Timer0(void);//定时器初始化
///////////////定义电机转动方向
#define Left_moto_back {P30=1,P31=0;} //左电机后退
#define Left_moto_go {P30=0,P31=1;} //左电机前进
#define Left_moto_stop {P30=1,P31=1;} //左电机停转
#define Right_moto_back {P32=1,P33=0;} //右电机后退
#define Right_moto_go {P32=0,P33=1;} //右电机前转
#define Right_moto_stop {P32=1,P33=1;} //右电机停转
//////////////////////////////
#define uchar unsigned char
#define uint unsigned int
/////////////////////////////
uchar pwm_val_left =0;
uchar push_val_left =0; //左电机占空比N/10
uchar pwm_val_right =0;
uchar push_val_right=0; //右电机占空比N/10
bit Right_moto_stp=1;
bit Left_moto_stp =1;
uint num,i,d,j=0;
/****************************************************************
********/
void run(void) //前进函数
{