基于单片机智能车仿真系统设计-毕设课设
按下仿真按钮后 没有任何反应
按下前进按键 小车全速前进 电机速度(两端电压)大概为69.2
按下后退按键 小车全速后退 电机速度(两端电压)大概为-69.2
按下左转弯按键 小车左转弯 左前轮左后轮速度(两端电压)大概30左右
右前轮右后轮速度(两端电压)大概50左右
按下右转弯按键 小车右转弯 左前轮左后轮速度(两端电压)大概50左右
右前轮右后轮速度(两端电压)大概30左右
按下停止按键 小车停止
#include<reg52.h>
#define uInt unsigned int
#define uChar unsigned char
#define PWM_MIN_STATE 300
#define PWM_MAX_STATE 700
uInt Time;
uInt Time1;
uInt Time2;
uInt Time3;
sbit ForwardKey = P1^0;
sbit BackKey = P1^1;
sbit TurnLeftKey = P1^2;
sbit TurnRightKey = P1^3;
sbit StopKey = P1^4;
sbit LeftFront1 = P0^0;
sbit LeftFront2 = P0^1;
sbit LeftFrontC = P2^0;
sbit LeftBehind1 = P0^2;
sbit LeftBehind2 = P0^3;
sbit LeftBehindC = P2^1;
sbit RightFront1 = P0^4;
sbit RightFront2 = P0^5;
sbit RightFrontC = P2^2;
sbit RightBehind1 = P0^6;
sbit RightBehind2 = P0^7;
sbit RightBehindC = P2^3;
void DelayMS(uInt t)
{
uInt i,j;
for(i=0;i<t;i++)
for(j=0;j<125;j++)
;
}
void CarMove()
{
LeftFront1=1;
LeftFront2=0;
LeftFrontC=1;