#include <reg52.h> //*******调头文件*******//
#define uchar unsigned char
#define uint unsigned int //*******宏定义*******//
sbit IN1 = P0 ^ 0;
sbit IN2 = P0 ^ 1;
sbit IN3 = P0 ^ 2;
sbit IN4 = P0 ^ 3; //**电机驱动**//
sbit PWM_EA = P0 ^ 4;
sbit PWM_EB = P0 ^ 5; //**初始化使能端**//
sbit led = P1 ^ 0;
sbit key_jia = P2 ^ 0; //**加速档位**//
sbit key_jian = P2 ^ 1; //**减速档位**//
sbit zhonglu = P1 ^ 0;
sbit zuolu = P1 ^ 1;
sbit youlu = P1 ^ 2;
sbit yuce = P1 ^ 3; //**初始化寻迹模块**//
uint N = 10;
uint pwm;
uchar T = 25; //**定时器周期**//
unsigned char zkb1 = 5; //**左边电机的占空比**//
unsigned char zkb2 = 5; //**右边电机的占空比**//
unsigned char num = 0; //**定时器中断计数器**//
void delayms(uint xms);
//*******后退函数*******//
void back()
{
IN1 = 1;
IN2 = 0;
IN3 = 1;
IN4 = 0;
}
//*******右转函数*******//
void right()
{
IN1 = 0;
IN2 = 0;
IN3 = 0;
IN4 = 1;
}
//*******左转函数*******//
void left()
{
IN1 = 0;
IN2 = 1;
IN3 = 0;
IN4 = 0;
}
//*******前进函数*******//
void straight()