📄 mmm.lst
字号:
C51 COMPILER V7.05 MMM 09/08/2004 21:09:47 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 unsigned char c ;
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 09/08/2004 21:09:47 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
64 void Delay(unsigned char idata x)
65 {
66 1
67 1
68 1 while(x-- != 0)
69 1 {
70 2 _nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_(
-) ;
71 2 _nop_() ;_nop_() ;_nop_() ;
72 2 }
73 1 }
74 /****************************************************************************
75 * *
76 * Function: init_com *
77 * *
78 * Input: - *
79 * Output: - *
80 * *
81 * Description: *
82 ****************************************************************************/
83 void init_com(void)
84 {
85 1 ES = 1; // Enable serail interrupts
86 1 ET0 = 1; // Enable t0 interrupts
87 1 RecvState = RECV_STX;
88 1 RecvReady = TRUE;
89 1 SendReady = FALSE;
90 1 SendOk = FALSE;
91 1 Cmdok = FALSE;
92 1 En485 = RECV;
93 1 EA=1;
94 1
95 1 }
96 /****************************************************************************
97 * *
98 * Function: START_T0 *
99 * *
100 * Input: - *
101 * Output: - *
102 * *
103 * Description: *
104 * *
105 * *
106 ****************************************************************************/
107 void START_T0com2(unsigned char x)
108 {
109 1 ET0 = 0 ;
110 1 TR0 = 0;
111 1 RXTimerOUT = x ;
112 1 TL0 = 0;
C51 COMPILER V7.05 MMM 09/08/2004 21:09:47 PAGE 3
113 1 TH0 = 0;
114 1 TR0 = 1;
115 1 ET0 = 1 ;
116 1 com2=1;
117 1 }
118 /****************************************************************************
119 * *
120 * Function: START_T0 *
121 * *
122 * Input: - *
123 * Output: - *
124 * *
125 * Description: *
126 * *
127 * *
128 ****************************************************************************/
129 void START_T0(unsigned char x)
130 {
131 1 ET0 = 0 ;
132 1 TR0 = 0;
133 1 Timer0Cnt = x ;
134 1 TL0 = 0;
135 1 TH0 = 0;
136 1 TR0 = 1;
137 1 ET0 = 1 ;
138 1 com1=1;
139 1 }
140 /****************************************************************************
141 * *
142 * Function: CALL_isr_T0 *
143 * *
144 * Input: - *
145 * Output: - *
146 * *
147 * Description: *
148 * *
149 * *
150 ****************************************************************************/
151 void CALL_isr_T0com2(void)
152 {
153 1 //TR0 = 0;
154 1 RXTimerOUT = 0;
155 1 //TF0 = 1;
156 1 com2=0;
157 1
158 1 }
159 /****************************************************************************
160 * *
161 * Function: CALL_isr_T0 *
162 * *
163 * Input: - *
164 * Output: - *
165 * *
166 * Description: *
167 * *
168 * *
169 ****************************************************************************/
170 void CALL_isr_T0(void)
171 {
172 1 // TR0 = 0;
173 1 Timer0Cnt = 0;
174 1 // TF0 = 1;
C51 COMPILER V7.05 MMM 09/08/2004 21:09:47 PAGE 4
175 1 com1=0;
176 1
177 1 }
178
179
180 //********************串口中断处理程序**************************************************************
181 void ub1ISR(void) interrupt 7 using 1
182 {
183 1 unsigned char data c;
184 1 if ( RI_1 ) // Receive Command
185 1 {
186 2
187 2 RI_1 = 0;
188 2 c = SBUF1;
189 2 switch(RXSTAT)
190 2 {
191 3 case 0: //接受帧头02
192 3 if(c==0x88)
193 3 {RXSTAT=1;START_T0com2(20); }
194 3 else
195 3 CALL_isr_T0com2();
196 3 break;
197 3 case 1: //接收
198 3 if(c==0xff)
199 3 {
200 4 RXSTAT=2;
201 4 START_T0com2(20);
202 4
203 4 }
204 3 else
205 3 {
206 4 RXSTAT=0;
207 4 CALL_isr_T0com2();
208 4 }
209 3
210 3 // RXSTAT=0;
211 3 break;
212 3 case 2:
213 3 x=c;
214 3 RXSTAT=3;
215 3 START_T0com2(20);
216 3 break;
217 3 case 3:
218 3 if(x==c)
219 3 {
220 4 rxok=1;
221 4 ring_flg=x;
222 4 }
223 3 RXSTAT=0;
224 3 x=0;
225 3 CALL_isr_T0com2();
226 3
227 3 break;
228 3 default:
229 3 RXSTAT=0;
230 3 break;
231 3 }
232 2
233 2 }
234 1 else
235 1 {
236 2 TI_1=0;
C51 COMPILER V7.05 MMM 09/08/2004 21:09:47 PAGE 5
237 2
238 2 }
239 1 }
240 /****************************************************************************
241 * *
242 * Function: isr_UART *
243 * *
244 * Input: - *
245 * Output: - *
246 * *
247 * Description: *
248 ****************************************************************************/
249 void isr_UART(void) interrupt 4 using 2
250 {
251 1
252 1
253 1 // WatchDog();
254 1
255 1 if ( RI ) // Receive Command
256 1 {
257 2 TR0 = 0 ; //stop t0
258 2 c = SBUF;
259 2 Test_led=! Test_led;
260 2 RI = 0;
261 2 En485=1;
262 2 _nop_(); _nop_(); _nop_(); _nop_(); _nop_();
263 2
264 2 SBUF=c;
265 2 while(!TI);
266 2 TI=0;
267 2 En485=0;
268 2 _nop_(); _nop_(); _nop_(); _nop_();
269 2
270 2 }
271 1
272 1 if ( TI && !RI )
273 1 {
274 2 TI = 0 ;
275 2
276 2 };
277 1
278 1 }
279 /*************************原有的函数需改变*************************************
280 * *
281 * Function: isr_timer0 *
282 * *
283 * Input: - *
284 * Output: - *
285 * *
286 * Description: *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -