📄 fm1715.lst
字号:
C51 COMPILER V7.09 FM1715 07/26/2005 17:00:30 PAGE 1
C51 COMPILER V7.09, COMPILATION OF MODULE FM1715
OBJECT MODULE PLACED IN FM1715.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE FM1715.C OPTIMIZE(0,SPEED) BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <reg52.h>
2 #include <absacc.h>
3 #include <intrins.h>
4 #include "FM1715_Reg.h"
5
6 uchar idata readdata[6];// _at_ 0x0040; //Read/write memory
7 uchar idata value[4]; // _at_ 0x0050; //Inc/Dec value
8 uchar idata KeySet; //password type
9 uchar idata tagtype[2];//_at_ 0x0096; //card indentify character
10
11 uchar idata PRO_SendBuf[16]; //_at_ 0x0080; //Send buffer
12 uchar idata PRO_RecvBuf[16]; //_at_ 0x0080; //Receive buffer
13 uchar idata buffer[24]; //_at_ 0x0060; //FM1715 command send/receive buffer
14 uchar idata UID[5]; // _at_ 0x007a; //User ID
15 uchar idata Secnr; // _at_ 0x0090; //sector number
16 uchar idata keybuffer[6]; //key save buffer
17
18 uchar idata keybuffer[6]={0xff,0xff,0xff,0xff,0xff,0xff}; //定义
19
20 //**********************************************************
21 //Name: Check_UID
22 //function: check card UID
23 //input: N/A
24 //output: TRUE UID right
25 // FALSE UID error
26 //**********************************************************'
27 uchar Check_UID(void)
28 {
29 1 uchar temp;
30 1 uchar i;
31 1
32 1 temp=0x00;
33 1 for(i=0;i<5;i++)
34 1 {
35 2 temp=temp^UID[i];
36 2 }
37 1 if(temp==0)
38 1 {
39 2 return TRUE;
40 2 }
41 1 return FALSE;
42 1 }
43
44 //*******************************************************************
45 //name:Save_UID
46 //function: This function sae card's serial number
47 //input: row : coflict row
48 // col : coflict line
49 // length: the length of received UID data
50 //output: N/A
51 //*******************************************************************
52 void Save_UID(uchar row,uchar col,uchar length)
53 {
54 1 uchar i;
55 1 uchar temp;
C51 COMPILER V7.09 FM1715 07/26/2005 17:00:30 PAGE 2
56 1 uchar temp1;
57 1
58 1 if((row == 0x00)&&(col==0x00))
59 1 {
60 2 for(i=0;i<length;i++)
61 2 {
62 3 UID[i]=buffer[i];
63 3 }
64 2 }
65 1 else
66 1 {
67 2 temp=buffer[0];
68 2 temp1=UID[row-1];
69 2 switch(col)
70 2 {
71 3 case 0:
72 3 temp1=0x00;
73 3 row=row+1;
74 3 break;
75 3 case 1:
76 3 temp=temp&0xFE;
77 3 temp1=temp1&0x01;
78 3 break;
79 3 case 2:
80 3 temp=temp&0xFC;
81 3 temp1=temp1&0x03;
82 3 break;
83 3 case 3:
84 3 temp=temp&0xF8;
85 3 temp1=temp1&0x07;
86 3 break;
87 3 case 4:
88 3 temp=temp&0xF0;
89 3 temp1=temp1&0x0F;
90 3 break;
91 3 case 5:
92 3 temp=temp&0xE0;
93 3 temp1=temp1&0x1F;
94 3 break;
95 3 case 6:
96 3 temp=temp&0xC0;
97 3 temp1=temp1&0x3F;
98 3 break;
99 3 case 7:
100 3 temp=temp&0x80;
101 3 temp1=temp1&0x7F;
102 3 break;
103 3 default:
104 3 break;
105 3 }
106 2 buffer[0]=temp;
107 2 UID[row-1]=temp1|temp;
108 2 for(i=1;i<length;i++)
109 2 {
110 3 UID[row-1+i]=buffer[i];
111 3 }
112 2 }
113 1 }
114
115 //*************************************************************
116 //name: Set_BitFraming
117 //function: set the byte that ready to send
C51 COMPILER V7.09 FM1715 07/26/2005 17:00:30 PAGE 3
118 //input: row : conflict row
119 // col : conflict col
120 //ouput: N/A
121 //*************************************************************
122 void Set_BitFraming(uchar row,uchar col)
123 {
124 1 switch(row)
125 1 {
126 2 case 0:
127 2 buffer[1]=0x20;
128 2 break;
129 2 case 1:
130 2 buffer[1]=0x30;
131 2 break;
132 2 case 2:
133 2 buffer[1]=0x40;
134 2 break;
135 2 case 3:
136 2 buffer[1]=0x50;
137 2 case 4:
138 2 buffer[1]=0x60;
139 2 break;
140 2 default:
141 2 break;
142 2 }
143 1
144 1 switch(col)
145 1 {
146 2 case 0:
147 2 Bit_Frame=0x00;
148 2 break;
149 2 case 1:
150 2 Bit_Frame=0x11;
151 2 buffer[1]=(buffer[1]|0x01);
152 2 break;
153 2 case 2:
154 2 Bit_Frame=0x22;
155 2 buffer[1]=(buffer[1]|0x02);
156 2 break;
157 2 case 3:
158 2 Bit_Frame=0x33;
159 2 buffer[1]=(buffer[1]|0x03);
160 2 break;
161 2 case 4:
162 2 Bit_Frame=0x44;
163 2 buffer[1]=(buffer[1]|0x04);
164 2 break;
165 2 case 5:
166 2 Bit_Frame=0x55;
167 2 buffer[1]=(buffer[1]|0x05);
168 2 break;
169 2 case 6:
170 2 Bit_Frame=0x66;
171 2 buffer[1]=(buffer[1]|0x06);
172 2 break;
173 2 case 7:
174 2 Bit_Frame=0x77;
175 2 buffer[1]=(buffer[1]|0x057);
176 2 break;
177 2 default:
178 2 break;
179 2 }
C51 COMPILER V7.09 FM1715 07/26/2005 17:00:30 PAGE 4
180 1 }
181
182 //************************************************************
183 //name: FM1715_Bus_Sel
184 //function: this function select FM1715 control bus?
185 //input: N/A
186 //output: TRUE, select bus succeed
187 // FALSE, select bus fail
188 //************************************************************
189 uchar FM1715_Bus_Sel(void)
190 {
191 1 uchar i;
192 1 Page_Sel=0x80;
193 1
194 1 for(i=0;i<RF_TimeOut;i++)
195 1 {
196 2 if(Command==0x00)
197 2 {
198 3 Page_Sel=0x00;
199 3 return TRUE;
200 3 }
201 2 }
202 1 return FALSE;
203 1 }
204
205 //********************************************************
206 //name: Init_FM1715
207 //function: Init FM1715
208 //input: mode: 0 -->TYPEA mode
209 // 1 -->TYPEB mode
210 // 2 -->shanghai mode
211 //ouput: N/A
212 //*********************************************************
213 void Init_FM1715(uchar mode)
214 {
215 1 // uchar idata temp;
216 1 uint i;
217 1
218 1 MFRST=1; //Reset FM1715
219 1 for(i=0;i<0x1fff;i++)
220 1 {
221 2 _nop_();
222 2 }
223 1
224 1 MFRST=0;
225 1 for(i=0;i<0x1fff;i++)
226 1 {
227 2 _nop_();
228 2 }
229 1
230 1 while(Command!=0) //waiting command=0, FM1715 Reset succeed
231 1 {
232 2 _nop_();
233 2 }
234 1
235 1 FM1715_Bus_Sel(); //Select FM1715 bus
236 1
237 1 TimerClock=0x0b; //151us/per
238 1 TimerControl=0x02; //发送结束开定时器,发送开始关定时器
239 1 TimerReload=0x42; //10ms interval
240 1 InterruptEn=0x7f; //Close all interrupt
241 1 // temp=InterruptEn; // ?????????????????????????????????????????????????
C51 COMPILER V7.09 FM1715 07/26/2005 17:00:30 PAGE 5
242 1 Int_Req=0x7f; //?????????????????????????????????????????????????
243 1 // MFOUTSelect=0x02; //for debug
244 1 TxControl=0x5b; //start TX1,TX2
245 1 if(mode==SHANGHAI_MODE) //shanghai mode
246 1 {
247 2 TypeSH=0x01;
248 2 }
249 1 else
250 1 {
251 2 TypeSH=0x00;
252 2 }
253 1
254 1 if(mode==TYPEB_MODE)
255 1 {
256 2 CoderControl=0x20;
257 2 TypeBFraming=0x05;
258 2 DecoderControl=0x19;
259 2 ChannelRedundancy=0x24;
260 2 TxControl=0x4b;
261 2 CWConductance=0x3f;
262 2 ModConductance=0x3f; //??????这里是否有问题
263 2 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -