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