📄 comr6c.lst
字号:
C51 COMPILER V7.09 COMR6C 09/11/2007 09:30:24 PAGE 1
C51 COMPILER V7.09, COMPILATION OF MODULE COMR6C
OBJECT MODULE PLACED IN comr6c.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE comr6c.c ROM(COMPACT) BROWSE DEBUG OBJECTEXTEND
line level source
1 #include "crc16.h"
2 #include "typedef.h"
3 #include "time.h"
4 #include "baseclk.h"
5 #include "comr6c.h"
6 #include "intrins.h"
7 #include "ll.h"
8
9 void _sendfifocmd(void)
10 {
11 1 bit flag;
12 1 uchar Bytecnt,nrofBytes ,bitcnt,nbBit,ISOcmd;
13 1 uint i;
14 1
15 1 ISOcmd = ReflectBYTE(pcdata[5]);
16 1 pcdata[1] = pcdata[1]&0x07;
17 1 if (pcdata[2]==0x16)
18 1 nrofBytes = pcdata[0]-3-2; //last 2 bytes are for CRC.
19 1 else if (pcdata[2]==0x18)
20 1 {
21 2 nrofBytes = 1; // send only command nr
22 2 pcdata[1] = 0;
23 2 }
24 1 else
25 1 nrofBytes = pcdata[0]-3;
26 1
27 1 _startBit();
28 1
29 1 for(Bytecnt=0;Bytecnt<nrofBytes ;Bytecnt++)
30 1 {
31 2 if(Bytecnt<nrofBytes-1)
32 2 nbBit = 8;
33 2 else if(!pcdata[1])
34 2 nbBit = 8;
35 2 else
36 2 nbBit = pcdata[1];
37 2 for(bitcnt=0;bitcnt<nbBit;bitcnt++)
38 2 {
39 3 _setTimer(2);
40 3 while ((DOUT)&&(!TIMERINT)); //FIFO Management
41 3 clrTimer();
42 3 pcdata[Bytecnt+3] = pcdata[Bytecnt+3] << 1;
43 3 flag = CY;
44 3 _sendBit(flag);
45 3 }
46 2 if(Bytecnt == 0)
47 2 {
48 3 for(i=0;i<0x5FF;i++);
49 3 }
50 2 }
51 1 switch (ISOcmd)
52 1 {
53 2 case 0x21: case 0x22: case 0x24:
54 2 case 0x27: case 0x28: case 0x29: case 0x2A:
55 2 case 0xA2: case 0xA3: case 0xa4: case 0xa5:
C51 COMPILER V7.09 COMR6C 09/11/2007 09:30:24 PAGE 2
56 2 {
57 3 _setTimer(2);
58 3 while((DOUT)&&(!TIMERINT)); _stopBit();
59 3
60 3 _clrTimer();
61 3 for(i=0;i<0xbff;i++); break;
62 3 }
63 2 }
64 1 }
65 void _gettagresponse(uchar responseaftercmd, char SID)
66 {
67 1 uchar Bytecnt,bitcnt, ASICRDY, TAGRDY, TAGDONE, bitval, temp;
68 1 bit b_col = 0;
69 1 b_collision = 0;
70 1 ASICRDY = 0; TAGRDY = 0;
71 1 while((DOUT)); _stopBit(); _nop_(); _nop_();
72 1 while((DOUT));
73 1 _trans1();
74 1 if (responseaftercmd) // wait for buffer to empty before cont.
75 1 {
76 2 TH0 = 0x63; TL0 = 0xc0; //12ms
77 2 _setTimer(TIME_OUT_ASICRDY); //wait for ERR-pulse
78 2 while ((!ERR)&&(!TIMERINT));
79 2 if (ERR)
80 2 {
81 3 while ((ERR)&&(!TIMERINT));
82 3 if (!ERR)
83 3 { //err pulse (typ. 18us) detected
84 4 ASICRDY = 1;
85 4 TH0 = 0x63; TL0 = 0xc0; //12ms
86 4 _setTimer(TIME_OUT_TAGRDY);
87 4 }
88 3 }
89 2 }
90 1 else
91 1 {
92 2 ASICRDY=1;
93 2 TH0 = 0x63; TL0 = 0xc0; //12ms
94 2 _setTimer(TIME_OUT_TAGRDY);
95 2 }
96 1 if(ASICRDY)
97 1 { // wait for tag to respond; wait for S2 signal.
98 2 while((!TAGRDY)&&(!TIMERINT))
99 2 {
100 3 if (_findS2())
101 3 {
102 4 TAGRDY=1;
103 4 TH0 = 0x63; TL0 = 0xc0; //12ms
104 4 _setTimer(TIME_OUT_READDATA);
105 4 }
106 3 }
107 2 }
108 1 if(TAGRDY)
109 1 {
110 2 TAGDONE=0;
111 2 bitcnt=0;
112 2 Bytecnt=3; //It's value is nr of bytes -1 (i.e. the value in [o])
113 2
114 2 temp= 0;
115 2 while ((!TAGDONE)&&(!TIMERINT))
116 2 {
117 3 bitval =_readbit();
C51 COMPILER V7.09 COMR6C 09/11/2007 09:30:24 PAGE 3
118 3 switch (bitval)
119 3 {
120 4 case 0x02:
121 4 b_col = 1;
122 4 break;
123 4
124 4 case 0x03:
125 4 TAGDONE =1; //received ES2
126 4 pcdata[Bytecnt] = temp;
127 4 pcdata[0] = Bytecnt;
128 4 pcdata[1] = bitcnt;
129 4 if(chkCRC(pcdata+3,Bytecnt-3))
130 4 {
131 5 userCardOk = 1;
132 5 }
133 4 break;
134 4
135 4 case 0x04: //timeout
136 4 break;
137 4
138 4 default:
139 4 if (bitcnt==8) //start new byte
140 4 {
141 5 if(Bytecnt <100)
142 5 {
143 6 pcdata[Bytecnt] = temp;
144 6 temp=0;
145 6 bitcnt =0;
146 6 Bytecnt++;
147 6 }
148 5 }
149 4 bitcnt++;
150 4 temp = temp*2 + bitval;
151 4 break;
152 4 }
153 3 }
154 2 }
155 1 else if (SID) //no tag in slot, doesn't mean timeout
156 1 TIMERINT=0;//TIFR = TIFR|0x10; //reset TIMERINT
157 1
158 1 b_collision = b_col;
159 1 _trans2(); //uctrl becomes again master of clock
160 1 _clrTimer();
161 1 }
162 uchar rd_ConReg(void)
163 {
164 1 uchar j,bitval;
165 1 bit flag;
166 1
167 1 pcdata[2]=0;
168 1 _startBit();
169 1 pcdata[0] =4;
170 1 pcdata[1] =0;
171 1 pcdata[2] =0;
172 1 pcdata[3]=0x71; /* send command */
173 1 for(j=0;j<8;j++)
174 1 {
175 2 pcdata[3] = pcdata[3] << 1;
176 2 flag = CY;
177 2 _sendBit(flag);
178 2 }
179 1 for(j=0;j<8;j++) /*get regCfg*/
C51 COMPILER V7.09 COMR6C 09/11/2007 09:30:24 PAGE 4
180 1 {
181 2 bitval = _rwbit(0);
182 2 pcdata[2] = pcdata[2]*2 + bitval;
183 2 }
184 1 _stopBit(); /*send ES1*/
185 1 pcdata[0] = 0x03;
186 1 pcdata[1] = 0x00;
187 1 return(pcdata[2]);
188 1 }
189
190 /*
191 void wr_Timereg(void)
192 {
193 pcdata[0] = 6;
194 pcdata[1] = 5;
195 pcdata[2] = 0;
196 pcdata[3] = 0x7B;
197 // pcdata[4] = 0xC3;
198 // pcdata[5] = 0x80;
199 pcdata[4] = 0xC1; //Time reg val
200 pcdata[5] = 0x80;
201 _command00();
202 }
203 ////////////////////////////////////////////////////
204 void wr_ConReg(uchar temp)
205 {
206 pcdata[0] = 5;
207 pcdata[1] = 0;
208 pcdata[2] = 0;
209 pcdata[3] = 0x7D;
210 pcdata[4] = temp; //control Reg val
211 _command00();
212 }
213 */
214 void switchon(void)
215 {
216 1 _startBit();
217 1 _sendBit(1);
218 1 _stopBit();
219 1 }
220 ////////////////////////////////////////////////////
221 /*
222 void switchoff(void)
223 {
224 SCLOCK = 0; _nop_();
225 DIN = 0; _nop_();
226 SCLOCK = 1; _nop_();
227 DIN = 1; _nop_();
228 DIN = 0; _nop_();
229 SCLOCK = 0 ; _nop_();
230 }
231 */
232 ////////////////////////////////////////////////////
233 /*
234 void powerDown(void)
235 {
236 pcdata[0] = 4;
237 pcdata[1] = 0;
238 pcdata[2] = 0;
239 pcdata[3] = 0x7E;
240 _command00();
241 }
C51 COMPILER V7.09 COMR6C 09/11/2007 09:30:24 PAGE 5
242 */
243 ////////////////////////////////////////////////////
244 /*
245 void powerUp(void)
246 {
247 uint i;
248 _startBit();
249 for(i=0;i<0x8ff;i++);
250 switchon();
251 }
252 */
253 ////////////////////////////////////////////////////
254 uchar _commandrd(void)
255 {
256 1 uchar i;
257 1 pcdata[1] = 0;
258 1 pcdata[2] = 0x00;
259 1 pcdata[3] = 0x30; /* 通讯参数设置:低数据率、FM调制*/
260 1
261 1
262 1 for(i= 4;i<pcdata[0];i++)
263 1 {
264 2 pcdata[i] = ReflectBYTE(pcdata[i]); /*数据倒序*/
265 2 }
266 1 _sendfifocmd();
267 1 _gettagresponse(1,0);
268 1 if (TIMERINT) { return(0); }
269 1 else { return(1); }
270 1 }
271
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 626 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 18
IDATA SIZE = ---- ----
BIT SIZE = ---- 3
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -