第一次做,这个是麦克纳姆轮轮的程序,看着是没有任何问题的,但是小车不会动,求大佬帮助.
程序如下
// An highlighted block
#include <REGX51.H>
#define uint unsigned int
#define uchar unsigned char
uint PWM = 5; //最大20,pwm调速
uchar time = 0;
uint Shi_Jian;
uint a,b,c,FJL,LJL,RJL;
void Delay (uint t) //@11.0592MHz 100us
{
unsigned char i;
while (t)
{
i = 43;
while (--i);
t--;
}
}
void Timer_Init() //定时器 @11.0592MHZ 0.1ms
{
TMOD = 0x11;
TH0 = 0xFB;
TL0 = 0xAF;
TF0 = 0;
ET0 = 1; //允许中断
EA = 1; //开启总中断
TR0 = 1; /开启定时器
TF1 = 0;
TH1 = 0;
TL1 = 0;
}
void Timer0_Rountine() interrupt 1 //T0 中断
{
time++;
TH0 = 0xFB;
TL0 = 0xAF;
if(time >= 20)
time = 0;
}
int Front_Ju_Li () //测前方距离