📄 main.lst
字号:
C51 COMPILER V7.20 MAIN 11/15/2005 18:46:56 PAGE 1
C51 COMPILER V7.20, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN Main.OBJ
COMPILER INVOKED BY: C:\Program Files\Keil Uvision V7.20\C51\BIN\C51.EXE Main.c BROWSE DEBUG OBJECTEXTEND SYMBOLS
line level source
1 //*************************************************************************************************
2 // Module Name : Main.C
3 // CreateDate : 2005-05-03
4 // ModifData : 2005-07-18
5 // Description : ( C8051F022 )
6 // Author : 李远正
7 // Version : V3.0
8 //*************************************************************************************************
9
10 #include <C8051F020.H>
11 #include <intrins.h>
12 #include <absacc.h>
13 #include <string.h>
14 #include <stdio.h>
15 #include <math.h>
16 #include "chinese.H"
17 #include "Initializes.H"
18 #include "Function.H"
19 #include "KS0108.H"
20 #include "12C887.H"
21 #include "WriteFile.H"
22 #include "Driver.H"
23
24 //=================================================================================================
25 // Global CONSTANTS
26 //=================================================================================================
27 // Key value
28 //
29 sfr KEY_PORT = 0x85;
30
31 #define KEY1 0x7E
32 #define KEY2 0x7D
33 #define KEY3 0x7B
34 #define KEY4 0x77
35 #define KEY5 0x6F
36 #define KEY6 0x5F
37 #define KEY7 0x3F
38
39 //-------------------------------------------------------------------------------------------------
40 //
41 #define qudou 8 // 按键去抖间隔
42
43 //*************************************************************************************************
44 //*************************************************************************************************
45 // Global VARIABLES
46 //*************************************************************************************************
47 //*************************************************************************************************
48 //
49 //=================================================================================================
50 // SMBus.C
51 //=================================================================================================
52 //
53 unsigned char xdata COMMAND; // Holds the slave address + R/W bit for
54 // use in the SMBus ISR.
55 unsigned char xdata DATA; // Holds data to be transmitted by the SMBus
C51 COMPILER V7.20 MAIN 11/15/2005 18:46:56 PAGE 2
56 // OR data that has just been received.
57
58 //-----------------------------------------------
59 // Device : 24AA512
60 unsigned char xdata HIGH_ADDR,LOW_ADDR; // The address
61 unsigned char xdata STEP; //
62 unsigned char xdata MODE; // The mode of operation: sigle or sequential data
63 unsigned char xdata *DATUM; // Holds sequential data to be transmitted by the SMBus
64 // OR sequential data that has just been received.
65 unsigned char xdata NUMBER; // Read the number of bytes
66
67 unsigned char xdata AA512_BUF[128]; // The sequential data from/to the slave device ( 24AA512 ).
68
69 //-----------------------------------------------
70 // MCU : C8051F022
71 unsigned char xdata OP_CODE; // Holds an op code to be sent or one
72 // that has just been received.
73 unsigned char xdata LOST_COMMAND; // Used to hold relevant data after a lost arbitration.
74 unsigned char xdata LOST_DATA;
75 unsigned char xdata LOST_CODE;
76
77 unsigned char xdata C8051F_DATA_BUF[16]; // Data buffer accessed by OP_CODE_HANDLER
78
79 bit LOST; // Arbitration lost flag, set when
80 // arbitration is lost while in master mode.
81 // Used to resume a failed transfer.
82 bit VALID_OP; // Flag used to determine if byte received
83 // as a slave is an OP_CODE or data.
84 bit DATA_READY; // Used by OP_CODE handler to flag when
85 // valid data has been received from the master
86
87 //-----------------------------------------------
88 bit WorkBusy; // Waiting before write/read data cycle completed
89
90 //=================================================================================================
91 // USP.C
92 //=================================================================================================
93 //
94 CMD_PARAM mCmdParam; // 默认情况下该结构将占用64字节的RAM,可以修改MAX_PATH_LEN常量,当修改为32时,只占用
-32字节的RAM
95
96 unsigned char xdata mIntStatus; // CH375模块的中断状态或者操作完成状态
97
98 //=================================================================================================
99 // WriteFile.C
100 //=================================================================================================
101 //
102 // 假定文件数据缓冲区: ExtRAM: 4000H-7FFFH [ 16KB ]
103 // 外部RAM的文件数据缓冲区,从该单元开始的缓冲区长度不小于一次读写的数据长度,最少为512字节
104 unsigned char xdata DATA_BUF[ 512 * 32 ] _at_ 0x4000; //
105 unsigned char xdata LAST_BUF[ 512 ] _at_ 0x3E00; // 用来读取原文件尾部不足一个扇区的零碎数据
106 unsigned char xdata *buffer; // 数据缓冲区指针,用于读写数据块
107
108 unsigned char superaddition; // 追加数据次数
109
110 unsigned int WriteFileSize; // 一次写入文件的大少
111 unsigned long TotalFileSize; // 文件总大小
112
113 //=================================================================================================
114 // Driver.C
115 //=================================================================================================
116 //
C51 COMPILER V7.20 MAIN 11/15/2005 18:46:56 PAGE 3
117 // speed configure
118 unsigned char xdata SPEED, SPEED1; // The speed of the CAR
119 unsigned char xdata FREQUENCY; // The frequency of PWM
120
121 bit SPEED_modify,FREQUENCY_modify;
122 //-------------------------------------------------------------------------------------------------
123 // distance
124 unsigned char xdata SECTION; // The section of the way: A,B,C
125 unsigned int xdata SECTION_BPoint, SECTION_CPoint, SECTION_BCPoint;
126
127 bit SECTION_BPoint_modify, SECTION_BCPoint_modify;
128
129 unsigned int xdata DistanceCount = 0; // The counts of the loops
130 unsigned int xdata DISTANCE = 0, DISTANCE_C; // The distance of the way ( 17cm/loop )
131
132 bit Flag_CArea;
133
134 //-------------------------------------------------------------------------------------------------
135 // time
136 unsigned char xdata JourneyTime, TimeBPoint, TimeCPoint;
137
138 bit Start, Stop;
139
140 //-------------------------------------------------------------------------------------------------
141 // The flag of operation
142 unsigned char xdata CarStatus;
143
144 bit B_SECTION;
145
146 bit forward, backward, turnright, turnleft;
147 bit Flag_LeftOver0, Flag_LeftOver1, Flag_RightOver0, Flag_RightOver1, Flag_Center;
148 bit Flag_Barrier;
149
150 //-------------------------------------------------------------------------------------------------
151 // The operation of Metal
152 unsigned char xdata MetalNumber; // 1--3
153 unsigned int xdata MetalDistance1, MetalDistance2;
154 unsigned int xdata MetalStartPoint, MetalEndPoint;
155
156 bit Flag_Metal;
157
158 //-------------------------------------------------------------------------------------------------
159 // The photoelectric cell
160 unsigned int xdata LightLeft, LightCenter, LightRight;
161 unsigned char xdata INTENSITY;
162
163 bit INTENSITY_modify;
164
165 //-------------------------------------------------------------------------------------------------
166 // Write file to USB
167 bit Write;
168
169
170 //=================================================================================================
171 // Main.C
172 //=================================================================================================
173 //
174 //-------------------------------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -