📄 mmm.lst
字号:
C51 COMPILER V7.05 MMM 01/30/2003 18:32:34 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 #include "595.H"
11 #include <stdio.h>
12 #define MID_LIMT 100
13 #define HIGH_LIMT 250
14 #define Z_PORT 3
15 static unsigned char xdata RemainRec[4][16];
16 unsigned char xdata Card_id[200];
17 unsigned char xdata Call_id[8];
18 unsigned char idata ring_flg=0,x,ADDR,ch4state=0;
19 unsigned int idata rest_delay=0,CH4_DELAY=0;
20 sbit SOND1=P0^1;
21 sbit SOND2=P0^2;
22 sbit SOND3=P0^3;
23 sbit CH4POW=P2^3;
24 //*********************************************************
25 union charint{
26 unsigned char chrX[2];
27 unsigned int intX;
28 };
29 union charint ad_temp, recordint;
30 //************************程序用的变量********************
31 unsigned char data RXtem[6];//程序接收数据缓冲区
32 unsigned char idata RXNOM,RXSTAT, RXdata[6];
33 unsigned char idata RXTimerOUT,com1=0,com2=0; //接收超时
34 bit rxok,Waring=0; // 接收完成标志
35
36
37 sbit CS=P2^4;
38 sbit PWR_UP=P2^5;
39 sbit TX_EN=P2^6;
40 sbit Test_led=P1^2;
41
42
43 /****************************************************************************/
44
45
46 void Delay100ms(unsigned char x)
47 {
48 1 unsigned char idata i,j;
49 1
50 1 while(x-- != 0)
51 1 {
52 2 for (j = 0;j < 74; j++)for (i = 0;i < 88; i++){_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;
53 3 _nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_(
-) ;
54 3 _nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_(
C51 COMPILER V7.05 MMM 01/30/2003 18:32:34 PAGE 2
-) ;
55 3 _nop_() ;_nop_() ;_nop_() ;};
56 2 }
57 1 }
58 /****************************************************************************/
59
60
61 void Delay1ms(unsigned char idata x)
62 {
63 1 unsigned char i;
64 1
65 1 while(x-- != 0)
66 1 {
67 2 for (i = 0;i < 89; i++){_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;
68 3 _nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_(
-) ;
69 3 _nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_(
-) ;
70 3 _nop_() ;_nop_() ;_nop_() ;};
71 2 }
72 1 }
73 /****************************************************************************
74 * *
75 * Function: init_com *
76 * *
77 * Input: - *
78 * Output: - *
79 * *
80 * Description: *
81 ****************************************************************************/
82 void init_com(void)
83 {
84 1 ES = 1; // Enable serail interrupts
85 1 EA=0;
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;
113 1 TH0 = 0;
C51 COMPILER V7.05 MMM 01/30/2003 18:32:34 PAGE 3
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;
175 1 com1=0;
C51 COMPILER V7.05 MMM 01/30/2003 18:32:34 PAGE 4
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 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -