資源簡介
c51循線小車程序 使用一個7路灰度傳感器 兩驅動差速轉彎
代碼片段和文件信息
#include?<12C5A60S2.H>
#include?
#define?uchar?unsigned?char
#define?uint?unsigned?int
//sbit?R_mott_fan=P3^4; ??//給二號單片機?右電機反轉信號
//sbit?L_mott_fan=P3^3; ??//給二號單片機?左電機反轉信號
sbit?L_mott_fan=P3^3; ??//給二號單片機?右電機信號
sbit?R_mott_fan=P3^4; ??//給二號單片機?右電機信號
sbit?L_mott_fan2=P1^7; ??//?左電機PWM信號 ?左
sbit?R_mott_fan2=P1^6; ??//?左電機PWM信號 ?右
//L_mott_fan=1; ? ?L_mott_fan2=1; ?//電機正轉
//R_mott_fan=0; ? ?R_mott_fan2=0; ?//電機正轉
//L_mott_fan=0; ? ?L_mott_fan2=0; ?//電機反轉
//R_mott_fan=1; ?????????R_mott_fan2=1;??????//電機反轉
//—————————————————————————定義液晶顯示器————————————————————————————
//-------------------------------------------------------------------
sbit?lcden=P3^5;
sbit?lcdrs=P3^7;
sbit?lcdrw=P3^6;
//—————————————————————————定義傳感器接口———————————————
評論
共有 條評論