📄 main.lst
字号:
C51 COMPILER V7.20 MAIN 12/08/2004 10:59:26 PAGE 1
C51 COMPILER V7.20, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\winXP\keil\C51\BIN\C51.EXE main.c LARGE WARNINGLEVEL(0) BROWSE INCDIR(D:\UsefulDocument\Mifare\M
-F RC500\MFRC500 Demo Reader\RC500\For Test) DEBUG OBJECTEXTEND CODE LISTINCLUDE SYMBOLS
line level source
1 /****************************************************************************
2 * *
3 * File: MAIN.C *
4 * *
5 * Version: 1.0 *
6 * *
7 * Created: 21.06.2002 *
8 * Last Change: 22.06.2002 *
9 * *
10 * Author: Steven Jiang Chang *
11 * *
12 * Compiler: KEIL C51 uVision2 V2.23 *
13 * *
14 * Description: 89C52RD2-Firmware for MFRC500 Demo Serial Reader *
15 * *
16 ****************************************************************************/
17
18 #define __SRC
19 #include "main.h"
1 =1 /****************************************************************************
2 =1 * *
3 =1 * File: MAIN.H *
4 =1 * *
5 =1 * Version: *
6 =1 * *
7 =1 * Created: 30.08.2001 *
8 =1 * Last Change: 30.08.2001 *
9 =1 * *
10 =1 * Author: Chua Joo Ming *
11 =1 * *
12 =1 * Compiler: KEIL C51 V4.10 *
13 =1 * *
14 =1 * Description: 89C52RD2-Firmware for MFRC500 Demo Serial Reader *
15 =1 * *
16 =1 ****************************************************************************/
17 =1
18 =1
19 =1 #define AUTODELAY
20 =1
21 =1 #ifdef __SRC
22 =1 #define EXTERN
23 =1 #else
=1 #define EXTERN extern
=1 #endif
26 =1
27 =1
28 =1 // Common Defines
29 =1
30 =1 #define uchar unsigned char
31 =1 #define uint unsigned int
32 =1 #define ulong unsigned long
33 =1
34 =1 #define FALSE 0
35 =1 #define TRUE 1
C51 COMPILER V7.20 MAIN 12/08/2004 10:59:26 PAGE 2
36 =1
37 =1
38 =1 #define INFO_CNT 23
39 =1
40 =1
41 =1 // Ports
42 =1
43 =1 #define ON 1
44 =1 #define OFF 0
45 =1
46 =1 // Configuration for the reader timeout counter
47 =1 // Timer 2 (modify OSC_FREQ if another crystal frequency is used)
48 =1 #define OSC_FREQ 22118400L
49 =1 // *note: when using the 8051RD2 (in 6 clk instructiion cycle,
50 =1 // use a crystal that is half the value state in OSC_FREQ.
51 =1 // Example: for OSC_FREQ=22118400, use 11059000 crystal.
52 =1
53 =1 #define BAUD_CNT 7
54 =1
55 =1 #define BAUD_115200 256 - (OSC_FREQ/192L)/115200L // 255
56 =1 #define BAUD_57600 256 - (OSC_FREQ/192L)/57600L // 254
57 =1 #define BAUD_38400 256 - (OSC_FREQ/192L)/38400L // 253
58 =1 #define BAUD_28800 256 - (OSC_FREQ/192L)/28800L // 252
59 =1 #define BAUD_19200 256 - (OSC_FREQ/192L)/19200L // 250
60 =1 #define BAUD_14400 256 - (OSC_FREQ/192L)/14400L // 248
61 =1 #define BAUD_9600 256 - (OSC_FREQ/192L)/9600L // 244
62 =1
63 =1 #ifdef __SRC
64 =1 uchar code BaudRateTable[BAUD_CNT] = {
65 =1 BAUD_115200,
66 =1 BAUD_57600,
67 =1 BAUD_38400,
68 =1 BAUD_28800,
69 =1 BAUD_19200,
70 =1 BAUD_14400,
71 =1 BAUD_9600
72 =1 };
73 =1 #else
=1 extern uchar code BaudRateTable[BAUD_CNT];
=1 #endif
76 =1
77 =1 #ifdef __SRC
78 =1 uint code CmpTable[BAUD_CNT + 1] = {
79 =1 0x078,
80 =1 0x095,
81 =1 0x129,
82 =1 0x1BD,
83 =1 0x252,
84 =1 0x37A,
85 =1 0x4A3,
86 =1 0x6F4
87 =1 };
88 =1 #else
=1 extern uint code CmpTable[BAUD_CNT + 1];
=1 #endif
91 =1
92 =1 // Serial Protocol
93 =1
94 =1 #define SOH 0x01 // Start of header
95 =1 #define STX 0x02 // Start of text
96 =1 #define ETX 0x03 // End of text
97 =1 #define ENQ 0x05 // Enquire
C51 COMPILER V7.20 MAIN 12/08/2004 10:59:26 PAGE 3
98 =1 #define ACK 0x06 // Acknowledge
99 =1 #define DLE 0x10 // Data link escape
100 =1 #define NAK 0x15 // Not acknowledge
101 =1
102 =1
103 =1 #define MAXREPCNT 2
104 =1
105 =1
106 =1 #define CALL_isr_UART() TI = 1
107 =1
108 =1
109 =1 #define SER_BCC 0
110 =1 #define SER_CRC 1
111 =1
112 =1 #define BCC_CHECKBYTECNT 1
113 =1
114 =1 // CCITT-CRC16 (x^16 + x^12 + x^5 + 1) => 0x11021
115 =1
116 =1 #define CRC_POLYNOM 0x1021
117 =1 #define CRC_PRESET 0xFFFF
118 =1 #define CRC_CHECKBYTECNT 2
119 =1
120 =1
121 =1 // Receive States
122 =1
123 =1 #define RECV_STX 0
124 =1 #define RECV_DATA_DLE_ETX 1
125 =1 #define RECV_ETX 2
126 =1
127 =1 #define RECV_DLE 3
128 =1 #define RECV_DLE_OR_NAK 4
129 =1
130 =1
131 =1 // Values for checking the Data Length of the Commands
132 =1
133 =1 #define MINCMDNR 0x40
134 =1 #define MAXCMDNR 0x57
135 =1
136 =1 #define CMDCNT MAXCMDNR - MINCMDNR + 1
137 =1
138 =1 #ifdef __SRC
139 =1
140 =1 uchar code CmdLenTab[CMDCNT] = {
141 =1
142 =1 // CmdNr: 0x40 ...
143 =1 7, 1, 5, 4, 2, 0, 1, 17, 5, 5, 1, 1, 14, 1, 2, 0,
144 =1
145 =1 // CmdNr: 0x50 ... ... 0x57
146 =1 1, 1, 2, 22, 1, 0, 3, 5};
147 =1 #else
=1
=1 extern uchar code CmdLenTab[CMDCNT];
=1
=1 #endif
152 =1
153 =1
154 =1 // Serial Buffer
155 =1
156 =1 #define HEADER 3
157 =1
158 =1 #define MAXDATA 30
159 =1
C51 COMPILER V7.20 MAIN 12/08/2004 10:59:26 PAGE 4
160 =1 #define SERBUFLEN HEADER + MAXDATA + CRC_CHECKBYTECNT + 1
161 =1
162 =1 #define SEQNR 0
163 =1
164 =1 #define COMMAND 1
165 =1 #define STATUS 1
166 =1
167 =1 #define LENGTH 2
168 =1
169 =1 #define MODE 3
170 =1 #define BCNT 3
171 =1 #define ADR 3
172 =1 #define SERNR 3
173 =1 #define SIZE 3
174 =1 #define TIME 3
175 =1 #define TAGTYPE 3
176 =1 #define INFO 3
177 =1 #define CTLBYTE 3
178 =1 #define PORTBYTE 3
179 =1 #define HLREQMODE 3
180 =1
181 =1 #define SECNR 4
182 =1 #define DATABYTES 4
183 =1 #define VALUE 4
184 =1 #define BAUD 4
185 =1 #define SERNR_in 4
186 =1 #define HL_SERNR 4
187 =1 #define KEY_ADDR 4
188 =1 #define POSITION 4
189 =1 #define SEL_CNT 4
190 =1
191 =1 #define TKEY 5
192 =1 #define AUTHADD 5
193 =1 #define DES_KEY 5
194 =1 #define MKAC 5
195 =1 #define CARD_ADDR 5
196 =1 #define NUM 5
197 =1
198 =1 #define CIPHER 6
199 =1
200 =1 #define AUTHMODE 7
201 =1
202 =1 #define ADRCHKWR 8
203 =1 #define HLAUTHMODE 8
204 =1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -