📄 finger.lst
字号:
C51 COMPILER V7.01 FINGER 03/08/2007 12:09:37 PAGE 1
C51 COMPILER V7.01, COMPILATION OF MODULE FINGER
OBJECT MODULE PLACED IN finger.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE finger.c OPTIMIZE(7,SPEED) REGFILE(.\fingerPRJ.ORC) BROWSE FLOATFUZZY(0) NO
-AREGS DEBUG OBJECTEXTEND CODE
stmt level source
1 #include "reg58.h"
2 #include "intrins.h"
3 #define _FINGER_C_
4 #include "finger.h"
5 #include "rxd.h"
6 #include "timer.h"
7 #include "define.h"
8 //#include "keypad.h"
9 #include "inout.h"
10 #include "system.h"
11 #include "setup.h"
12 #include "user.h"
13 #include "373.h"
14 #include "keypad.h"
15
16
17
18
19 //unsigned short code comm_parameter[]=
20 //{
21 // 2,0,0,1024,4,1,0,0,2,480,0,0,16,16,16,16,
22 //};/
23 //unsigned short code ack_parameter[]=
24 //{
25 // 0,0,0,0,1024,0,0,480,0,0,0,0,0,16,2,
26 //};
27
28 bit getfimpackage(unsigned char cmd)
29 {
30 1 unsigned char temptime,tempcrchigh,tempcrclow;
31 1 unsigned short datalen;
32 1 temptime=timerh;
33 1 while((timerh-temptime)<TFIMRXDTIME)
34 1 {
35 2 if(rxd0packflag)
36 2 {
37 3
38 3 //unsigned char crclow,crchigh;
39 3 rxd0packflag=0;
40 3
41 3 datalen=(uart0buff[2]<<8)|uart0buff[1];
42 3 //datalen|=uart0buff[1];
43 3
44 3 tempcrclow=uart0buff[datalen+3];
45 3 tempcrchigh=uart0buff[datalen+4];
46 3 //tempbuff[0]=uart0buff[datalen+3];
47 3 //tempbuff[1]=uart0buff[datalen+4];
48 3 checkcrc(datalen+2);
49 3 //if((tempbuff[0]==uart0buff[datalen+3])&&(tempbuff[1]==uart0buff[datalen+4]))
50 3 if((tempcrclow==uart0buff[datalen+3])&&(tempcrchigh==uart0buff[datalen+4]))
51 3 {
52 4 if(uart0buff[PFIMRXDCOMM]!=cmd)return FALSE;
53 4 if(uart0buff[PFIMRETURN])return FALSE;
54 4 return TRUE;
C51 COMPILER V7.01 FINGER 03/08/2007 12:09:37 PAGE 2
55 4 }
56 3 else return FALSE;
57 3 }
58 2 }
59 1 return FALSE;
60 1
61 1 }
62 void fimrxdready()
63 {
64 1 rxd0packflag=0;
65 1 //rxd0len=0xffff;
66 1
67 1 }
68 bit rchecklink()
69 {
70 1 //rfimcommnp(RCHECKLINK);
71 1 //unsigned char code checklinkcmd[13]={0x81,0x08,00,00,00,00,00,01,00,01,00,0x4A,0x6C };
72 1 unsigned char code commbuff[13]={0x81,0x08,00,00,00,00,00,01,00,01,00,0x4A,0x6C };
73 1 //while(1)
74 1 //{
75 1 code2uart0(commbuff,13);
76 1 sendstring(13);
77 1 //}
78 1 fimrxdready();
79 1 return getfimpackage(RCHECKLINK);
80 1 //if(getfimpackage(RCHECKLINK))
81 1 //{
82 1 // if(uart0buff[PFIMRXDCOMM]!=RCHECKLINK)return FALSE;
83 1 // if(uart0buff[PFIMRETURN])return FALSE;
84 1 //}
85 1 }
86 bit rsetcommstate()
87 {
88 1 unsigned char code commbuff[13]={0x81,0x0a,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00};
89 1 code2uart0(commbuff,13);
90 1 checkcrc(12);
91 1 sendstring(15);
92 1
93 1 fimrxdready();
94 1 return getfimpackage(RSETCOMMSTATE);
95 1
96 1 }
97 /*bit rmatchfinger()
98 {
99 rfimcommnp(RCAPTURECHECKIMAGE);
100 fimrxdready();
101
102 return getfimpackage(RMATCHFINGER);
103 //if(getfimpackage(RMATCHFINGER))
104 //{
105 // if(uart1buff[PFIMRXDCOMM]!=RMATCHFINGER)return FALSE;
106 // if(uart1buff[PFIMRETURN])return FALSE;
107 //}
108 //return TRUE;
109 }*/
110 bit rcapturecheckimage()
111 {
112 1 unsigned char code commbuff[11]={0x81,0x08,0x00,0x00,0x00,0x00,0x00,0x01,0x00,RCAPTURECHECKIMAGE,0x00};
113 1 code2uart0(commbuff,11);
114 1 checkcrc(10);
115 1 sendstring(13);
116 1
C51 COMPILER V7.01 FINGER 03/08/2007 12:09:37 PAGE 3
117 1 fimrxdready();
118 1
119 1 return getfimpackage(RCAPTURECHECKIMAGE);
120 1
121 1 }
122 /////////////////////////////////////////////////////////////////////
123 bit rextractfeature(unsigned char extractstep,unsigned char flag)
124 {
125 1 unsigned char code commbuff[13]={0x81,0x0a,0x00,0x00,0x00,0x00,0x00,0x01,0x00,REXTRACTFEATURE,0x00,0x00,0
-x00};
126 1 code2uart0(commbuff,13);
127 1 uart0buff[11]=extractstep;
128 1 uart0buff[12]=flag;
129 1 checkcrc(12);
130 1 sendstring(15);
131 1
132 1 fimrxdready();
133 1 return getfimpackage(REXTRACTFEATURE);
134 1
135 1 }
136 /////////////////////////////////////////////////////////////
137 bit radduser(unsigned char flag)
138 {
139 1 unsigned char code commbuff[]={0x81,41,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x20,0x00};
140 1 code2uart0(commbuff,11);
141 1 if(flag==ADDUSERNOFINGER)
142 1 {
143 2 //buffcopycomm((unsigned char*)puser,uart0buff+11,32);
144 2 uart0buff[PRFIMPARAM]=currentsn;
145 2 uart0buff[PRFIMPARAM+1]=currentsn>>8;
146 2 uart0buff[43]=0;
147 2 checkcrc(43);
148 2 sendstring(46);
149 2 }
150 1 else
151 1 {
152 2 uart0buff[43]=1;
153 2 uart0buff[PRFIMPARAM]=currentsn;
154 2 uart0buff[PRFIMPARAM+1]=currentsn>>8;
155 2 uart0buff[1]=0x09;
156 2 uart0buff[2]=0x02;
157 2 checkcrc(523);
158 2 sendstring(526);
159 2 }
160 1
161 1 fimrxdready();
162 1 return getfimpackage(RADDUSER);
163 1
164 1 }
165 ////////////////////////////////////////////////
166 bit rdeletealluser()
167 {
168 1 unsigned char code commbuff[14]={0x81,0x09,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x21,0x00,0x00,0x98,0xBB};
169 1 code2uart0(commbuff,14);
170 1 sendstring(14);
171 1
172 1 fimrxdready();
173 1
174 1 return getfimpackage(RDELETEUSER);
175 1 }
176 /////////////////////////////////////////////////////////////////////
177 bit rdeleteuserbysn()
C51 COMPILER V7.01 FINGER 03/08/2007 12:09:37 PAGE 4
178 {
179 1 unsigned char code commbuff[17]={0x81,0x0e,0x00,0x00,0x00,0x00,0x00,0x01,0x00,RDELETEUSER,0x00,0x01,0x00,
-0x00,0x01,0x00,0xff};
180 1 code2uart0(commbuff,17);
181 1 uart0buff[13]=(unsigned char)currentsn;
182 1 uart0buff[15]=(unsigned char)(currentsn>>8);
183 1 checkcrc(16);
184 1 sendstring(19);
185 1
186 1 fimrxdready();
187 1 return getfimpackage(RDELETEUSER);
188 1 }
189 bit rgetuserbysn(unsigned char flag)
190 {
191 1 unsigned char code commbuff[18]={0x81,0x0f,0x00,0x00,0x00,0x00,0x00,0x01,0x00,RGETUSER,0x00,0x01,0x00,0x0
-0,0x01,0x00,0xff,0x00};
192 1 code2uart0(commbuff,18);
193 1 uart0buff[13]=(unsigned char)currentsn;
194 1 uart0buff[15]=(unsigned char)(currentsn>>8);
195 1 if(flag!=ADDUSERNOFINGER)uart0buff[17]=1;
196 1 checkcrc(17);
197 1 sendstring(20);
198 1
199 1 fimrxdready();
200 1 if(getfimpackage(RGETUSER))
201 1 {
202 2 if(uart0buff[PAFIMPARAM])return FALSE;
203 2 return TRUE;
204 2 }
205 1 return FALSE;
206 1 }
207 ///////////////////////////////////////////////////////////////////////////////////
208 bit capturecheckimage()
209 {
210 1 unsigned char temptime;
211 1 temptime=timerh;
212 1 while((timerh-temptime)<TFIMCAPTURETIME)
213 1 {
214 2 if(rcapturecheckimage())return TRUE;
215 2 }
216 1 return FALSE;
217 1
218 1 }
219 ///////////////////////////////////////////////////////////////////////////////////////////
220 bit registerfp()
221 {
222 1 displaymessage(LMTOREGISTERFP,LINE1);
223 1 displaymessage(LMPUTFPON,LINE2);
224 1 delayTimerh(TMSGWAITTIME);
225 1
226 1 if(!capturecheckimage()) return FALSE;
227 1
228 1 if(!rextractfeature(0,0)) return FALSE;
229 1
230 1 set_373(BEEPPORT);
231 1 delay60ms();
232 1 clr_373(BEEPPORT);
233 1
234 1 //if(!waitliftfinger()) return FALSE;
235 1 displaymessage(LMLIFTANDPUT,LINE1);
236 1 displaymessage(LMWAITTING,LINE2);
237 1 delayTimerh(TMSGWAITTIME);
C51 COMPILER V7.01 FINGER 03/08/2007 12:09:37 PAGE 5
238 1
239 1 set_373(BEEPPORT);
240 1 delay60ms();
241 1 clr_373(BEEPPORT);
242 1
243 1 if(!capturecheckimage()) return FALSE;
244 1 if(!rextractfeature(1,0)) return FALSE;
245 1
246 1 //if(!waitliftfinger()) return FALSE;
247 1 set_373(BEEPPORT);
248 1 delay60ms();
249 1 clr_373(BEEPPORT);
250 1
251 1 displaymessage(LMLIFTANDPUTAGAIN,LINE1);
252 1 displaymessage(LMWAITTING,LINE2);
253 1 delayTimerh(TMSGWAITTIME);
254 1
255 1 set_373(BEEPPORT);
256 1 delay60ms();
257 1 clr_373(BEEPPORT);
258 1
259 1 if(!capturecheckimage()) return FALSE;
260 1 if(!rextractfeature(2,0)) return FALSE;
261 1
262 1 if(!radduser(ADDUSERNOFINGER)) return FALSE;
263 1
264 1 set_373(BEEPPORT);
265 1 delay60ms();
266 1 clr_373(BEEPPORT);
267 1
268 1 return TRUE;
269 1
270 1 }
271 ///////////////////////////////////////////////////////////////////////////////////////////
272 void init_finger()
273 {
274 1 //unsigned short usernum;
275 1 //if(!rchecklink())return FALSE;
276 1 //i/f(!rsetcommstate())return FALSE; //change baud rate to 38400
277 1 //while(!rcheckline());
278 1
279 1 //return TRUE;
280 1 delayTimerh(T500MS); //051017
281 1 delayTimerh(T500MS); //051017
282 1 delayTimerh(T500MS); //051017
283 1 delayTimerh(T500MS); //051017
284 1 delayTimerh(T500MS); //051017
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -