📄 smartcar.h
字号:
/********************************************************\
Declaration of Valuebales
\********************************************************/
//缓存大小
#define row_max 36 //40行
#define col_max 90 //90列
//PINGPONG参数
#define PING 1
#define PONG 0
//舵机参数
#define SERVO_LEFT 8470
#define SERVO_CENTER 7300
#define SERVO_RIGHT 6300
//PID系数
#define KP 10;
#define KI 0
#define KD 5;
#define KP_w 10
#define KD_w 20
#define KI_w 0
#define valve 25
#define VIDEO_LEFT 7
#define VIDEO_CENTER 53
#define VIDEO_RIGHT 88
//#define top 3
/********************************************************\
Define variables
\********************************************************/
byte W_or_N=0; //宽窄道区别 wide or narrow of the road
// 0 is wide, 1 is narrow
byte startline;
byte PingOrPong; //PING =1 ,PONG =0
byte onSamplenum;
byte startflag;
byte feng;
//舵机PID算法变量
signed char curve;
signed char last_curve;
signed char AngleWay;
word servoOUT;
// variables below are used in speed measure
word cur_speed; // current speed
word last_speed; // used to save data in PA process
word speed; // used to set PWM value
//byte counter=0; // temporary counter in Speed detect
//数据矩阵
byte ImagePing[row_max][col_max];
byte ImagePong[row_max][col_max]; //ping pong双缓存,大小30*90
byte GuideLine[row_max]; //中线位置存储
byte *ImageReady;
//引导线提取
byte line_left; //黑线左
byte line_right; //黑线右
char line_width; //线宽
//图象处理
byte err_line[row_max]; //错误行数 0=无错,1=有错
byte abandon; //本场图象是否无效 0=有效;1=无效
byte top;
byte s1,s2;
signed char errWay,errWay1,errWay2;
//sci
byte hang;
byte lie;
//常用变量
byte x,y,z,accumu=0;
/********************************************************\
Declaration of Functions
\********************************************************/
void Delay (dword delaytime);
void Overall_ini (void);
void Set_PLL (void);
void PWM_ini (void);
void SCI_ini (void);
void Capture_ini (void);
void ADC_ini(void);
void Image_ini (void);
void CCD_get (void);
byte Get_line (void);
void DealNearLine(byte LineNum);
void DealFarLine(byte LineNum);
void Get_speed (void);
void PWM_PID_servo(void);
void Speed_feedback_ctl(void);
//void Start_Switch(void);
void Sci_Send(byte onsend);
void put_char(byte *p,byte n);
void send_image(void);
byte absl(signed char number);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -