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