代码拉取完成,页面将自动刷新
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)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。