📄 mmm.lst
字号:
C51 COMPILER V7.05 MMM 03/01/2002 11:48:58 PAGE 1
C51 COMPILER V7.05, COMPILATION OF MODULE MMM
OBJECT MODULE PLACED IN mmm.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE mmm.c BROWSE DEBUG OBJECTEXTEND
stmt level source
1 //#include <reg52.h>
2 #include<w77c32.h>
3 #include <absacc.h>
4 #include "string.h"
5 #include "serial.h"
6 #include "intrins.h"
7 #include "e25045.h"
8 #include "comm.h"
9 static unsigned char xdata RemainRec[4][16];
10 unsigned char xdata Card_id[200];
11 unsigned char idata ring_flg=0,x,ADDR;
12 //*********************************************************
13 union charint{
14 unsigned char chrX[2];
15 unsigned int intX;
16 };
17 union charint ad_temp, recordint;
18 //************************程序用的变量********************
19 unsigned char data RXtem[6], RXdata[6];//程序接收数据缓冲区
20 unsigned char data RXNOM,RXSTAT;
21 unsigned char data RXTimerOUT,com1=0,com2=0; //接收超时
22 bit rxok,Waring=0; // 接收完成标志
23
24
25 sbit CS=P2^4;
26 sbit PWR_UP=P2^5;
27 sbit TX_EN=P2^6;
28 sbit Test_led=P1^4;
29
30
31 /****************************************************************************/
32
33
34 void Delay100ms(unsigned char x)
35 {
36 1 unsigned char i,j;
37 1
38 1 while(x-- != 0)
39 1 { //Watch_dog();
40 2 for (j = 0;j < 114; j++)for (i = 0;i < 88; i++){_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;
41 3 _nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_(
-) ;
42 3 _nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_(
-) ;
43 3 _nop_() ;_nop_() ;_nop_() ;};
44 2 }
45 1 }
46 /****************************************************************************/
47
48
49 void Delay1ms(unsigned char idata x)
50 {
51 1 unsigned char i;
52 1
53 1 while(x-- != 0)
C51 COMPILER V7.05 MMM 03/01/2002 11:48:58 PAGE 2
54 1 { Watch_dog();
55 2 for (i = 0;i < 89; i++){_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;
56 3 _nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_(
-) ;
57 3 _nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_(
-) ;
58 3 _nop_() ;_nop_() ;_nop_() ;};
59 2 }
60 1 }
61 /****************************************************************************
62 * *
63 * Function: init_com *
64 * *
65 * Input: - *
66 * Output: - *
67 * *
68 * Description: *
69 ****************************************************************************/
70 void init_com(void)
71 {
72 1 ES = 1; // Enable serail interrupts
73 1 ET0 = 1; // Enable t0 interrupts
74 1 RecvState = RECV_STX;
75 1 RecvReady = TRUE;
76 1 SendReady = FALSE;
77 1 SendOk = FALSE;
78 1 Cmdok = FALSE;
79 1 En485 = RECV;
80 1 EA=1;
81 1
82 1 }
83 /****************************************************************************
84 * *
85 * Function: START_T0 *
86 * *
87 * Input: - *
88 * Output: - *
89 * *
90 * Description: *
91 * *
92 * *
93 ****************************************************************************/
94 void START_T0com2(unsigned char x)
95 {
96 1 ET0 = 0 ;
97 1 TR0 = 0;
98 1 RXTimerOUT = x ;
99 1 TL0 = 0;
100 1 TH0 = 0;
101 1 TR0 = 1;
102 1 ET0 = 1 ;
103 1 com2=1;
104 1 }
105 /****************************************************************************
106 * *
107 * Function: START_T0 *
108 * *
109 * Input: - *
110 * Output: - *
111 * *
112 * Description: *
113 * *
C51 COMPILER V7.05 MMM 03/01/2002 11:48:58 PAGE 3
114 * *
115 ****************************************************************************/
116 void START_T0(unsigned char x)
117 {
118 1 ET0 = 0 ;
119 1 TR0 = 0;
120 1 Timer0Cnt = x ;
121 1 TL0 = 0;
122 1 TH0 = 0;
123 1 TR0 = 1;
124 1 ET0 = 1 ;
125 1 com1=1;
126 1 }
127 /****************************************************************************
128 * *
129 * Function: CALL_isr_T0 *
130 * *
131 * Input: - *
132 * Output: - *
133 * *
134 * Description: *
135 * *
136 * *
137 ****************************************************************************/
138 void CALL_isr_T0com2(void)
139 {
140 1 //TR0 = 0;
141 1 RXTimerOUT = 0;
142 1 //TF0 = 1;
143 1 com2=0;
144 1
145 1 }
146 /****************************************************************************
147 * *
148 * Function: CALL_isr_T0 *
149 * *
150 * Input: - *
151 * Output: - *
152 * *
153 * Description: *
154 * *
155 * *
156 ****************************************************************************/
157 void CALL_isr_T0(void)
158 {
159 1 // TR0 = 0;
160 1 Timer0Cnt = 0;
161 1 // TF0 = 1;
162 1 com1=0;
163 1
164 1 }
165
166
167 //********************串口中断处理程序**************************************************************
168 void ub1ISR(void) interrupt 7 using 1
169 {
170 1 unsigned char data c;
171 1 if ( RI_1 ) // Receive Command
172 1 {
173 2
174 2 RI_1 = 0;
175 2 c = SBUF1;
C51 COMPILER V7.05 MMM 03/01/2002 11:48:58 PAGE 4
176 2 switch(RXSTAT)
177 2 {
178 3 case 0: //接受帧头02
179 3 if(c==0x88)
180 3 {RXSTAT=1;START_T0com2(20); }
181 3 else
182 3 CALL_isr_T0com2();
183 3 break;
184 3 case 1: //接收
185 3 if(c==0xff)
186 3 {
187 4 RXSTAT=2;
188 4 START_T0com2(20);
189 4
190 4 }
191 3 else
192 3 {
193 4 RXSTAT=0;
194 4 CALL_isr_T0com2();
195 4 }
196 3
197 3 // RXSTAT=0;
198 3 break;
199 3 case 2:
200 3 x=c;
201 3 RXSTAT=3;
202 3 START_T0com2(20);
203 3 break;
204 3 case 3:
205 3 if(x==c)
206 3 {
207 4 rxok=1;
208 4 ring_flg=x;
209 4 }
210 3 RXSTAT=0;
211 3 x=0;
212 3 CALL_isr_T0com2();
213 3
214 3 break;
215 3 default:
216 3 RXSTAT=0;
217 3 break;
218 3 }
219 2
220 2 }
221 1 else
222 1 {
223 2 TI_1=0;
224 2
225 2 }
226 1 }
227 /****************************************************************************
228 * *
229 * Function: isr_UART *
230 * *
231 * Input: - *
232 * Output: - *
233 * *
234 * Description: *
235 ****************************************************************************/
236 void isr_UART(void) interrupt 4 using 2
237 {
C51 COMPILER V7.05 MMM 03/01/2002 11:48:58 PAGE 5
238 1 unsigned char c , oldRecvState , i , bcc;
239 1
240 1 // WatchDog();
241 1
242 1 if ( RI ) // Receive Command
243 1 {
244 2 TR0 = 0 ; //stop t0
245 2 c = SBUF;
246 2 RI = 0;
247 2 if (RecvReady)
248 2 {
249 3 SendReady = FALSE;
250 3 oldRecvState = RecvState;
251 3 RecvState = RECV_STX;
252 3
253 3
254 3 switch (oldRecvState)
255 3 {
256 4 case RECV_STX: // Receive STX and answer DLE
257 4 if (c == STX)
258 4 {
259 5 RecvState = RECV_ADDR0;
260 5 START_T0(T_533_ms);
261 5 }
262 4 else
263 4 {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -