1 Star 0 Fork 0

cxl-starkchen/smartCar

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
track.lst 3.11 KB
一键复制 编辑 原始数据 按行查看 历史
cxl-starkchen 提交于 2021-11-09 16:05 . local
C51 COMPILER V9.52.0.0 TRACK 06/16/2021 21:27:37 PAGE 1
C51 COMPILER V9.52.0.0, COMPILATION OF MODULE TRACK
OBJECT MODULE PLACED IN track.obj
COMPILER INVOKED BY: C:\Users\starkchen\Keil4\C51\BIN\C51.EXE src\track.c BROWSE DEBUG OBJECTEXTEND PRINT(.\track.lst) T
-ABS(2) OBJECT(track.obj)
line level source
1 #include <reg52.h>
2 #include "track.h"
3 #include "motor.h"
4 #include "delay.h"
5 #include "PWM.h"
6 #include "Serial.h"
7 #include "led.h"
8 #include "bt.h"
9
10 sbit in1 = P2 ^ 1; // left
11 sbit in3 = P2 ^ 3; // right
12
13 extern int flag;
14 extern int Serial_Data;
15
16 uint track_detect()
17 {
18 1 if (in1 == 0 && in3 == 1) return IN1_DETECTED;
19 1 else if (in1 == 1 && in3 == 0) return IN3_DETECTED;
20 1 else if (in1 == 0 && in3 == 0) return ALL_DETECTED;
21 1 else if (in1 == 1 && in3 == 1) return NOT_DETECTED;
22 1 return -1;
23 1 }
24
25
26 int track_auto()
27 {
28 1 int signal;
29 1 while (1)
30 1 {
31 2 signal = Serial_Data;
32 2 if (signal == BTEXIT)
33 2 {
34 3 return 0; // �˳��Զ�Ѱ��
35 3 }
36 2
37 2 if (in1 == WHITE && in3 == WHITE)
38 2 {
39 3 //motor_forword();
40 3 flag = BTFORWORD;
41 3 //if (Serial_Data == BTEXIT) return 0;
42 3 }
43 2 else if (in1 == BLACK && in3 == WHITE)
44 2 {
45 3 //flag = BTRIGHT;
46 3 flag = BT_RIGHT_SPIN;
47 3 //if (Serial_Data == BTEXIT) return 0;
48 3 //motor_turn(RIGHT);
49 3 }
50 2 else if (in1 == WHITE && in3 == BLACK)
51 2 {
52 3 //flag = BTLEFT;
53 3 flag = BT_LEFT_SPIN;
54 3 //if (Serial_Data == BTEXIT) return 0;
C51 COMPILER V9.52.0.0 TRACK 06/16/2021 21:27:37 PAGE 2
55 3 //motor_turn(LEFT);
56 3 }
57 2 else
58 2 {
59 3 flag = BTSTOP;
60 3 //if (Serial_Data == BTEXIT) return 0;
61 3 //motor_reset();
62 3 }
63 2 }
64 1
65 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 109 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/cxl-starkchen/smartCar.git
git@gitee.com:cxl-starkchen/smartCar.git
cxl-starkchen
smartCar
smartCar
main

搜索帮助