📄 main.lst
字号:
C51 COMPILER V7.09 MAIN 08/18/2006 08:26:15 PAGE 1
C51 COMPILER V7.09, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #define __SRC
2 #include "main.h"
3 #undef __SRC
4
5 #include "zlg500.h"
6
7 #define MF1_S50 0
8 #define MF1_S70 1
9 #define MF0_ULIGHT 2
10 #define MF1_LIGHT 3
11
12 sbit zlg500_RST=P1^4;
13
14 uchar code Nkey_a[6] = {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5};
15 uchar code Nkey_b[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
16 uchar idata cfg1[16] = {0x00,0x58,0x3f,0x3f,0x19,0x13,0x00,0x00,0x00,0x73,0x08,0xad,0xff,0x00,0x41,0x00};
17 uchar idata cfg2[16] = {0x00,0x06,0x03,0x63,0x63,0x00,0x00,0x00,0x00,0x08,0x07,0x06,0x0a,0x02,0x00,0x00};
18
19 main()
20 {
21 1 uchar cardtype = MF1_S50;
22 1 uchar idata card_snr[8];
23 1 uchar idata databuf[16];
24 1 long idata value=1;
25 1 uchar i,j,addc;
26 1
27 1 zlg500_RST=1;
28 1 for(i=255;i>0;i--)
29 1 for(j=255;j>0;j--);
30 1 zlg500_RST=0;
31 1 for(i=255;i>0;i--)
32 1 for(j=255;j>0;j--);
33 1 spi_init();
34 1 EA=1;
35 1
36 1 i=mifs_config();
37 1
38 1 i=mifs_get_info(databuf);
39 1 i=mifs_clr_control_bit();
40 1 i=mifs_set_control_bit();
41 1 i=mifs_read_E2(0x10,16,databuf);
42 1 databuf[0]=0x01;
43 1 // i=mifs_write_E2(0x10,16,cfg1);
44 1 // i=mifs_write_E2(0x20,16,cfg2);
45 1 mifs_load_key(KEYA,5,Nkey_b);
46 1 i=mifs_write_reg(0x11,0x59);
47 1 i=mifs_write_reg(0x12,0x3f);
48 1
49 1 while(1)
50 1 {
51 2 while(mifs_request(IDLE,databuf)!=MI_OK);
52 2 addc=0x77;
53 2 if(mifs_cascanticoll(ANTICOLL1,0,card_snr)!=MI_OK) continue;
54 2 if(mifs_cascselect(ANTICOLL1,card_snr,&i)!=MI_OK) continue;
55 2 if(i&0x04)
C51 COMPILER V7.09 MAIN 08/18/2006 08:26:15 PAGE 2
56 2 {
57 3 if(mifs_cascanticoll(ANTICOLL2,0,card_snr+4)!=MI_OK) continue;
58 3 if(mifs_cascselect(ANTICOLL2,card_snr+4,&i)!=MI_OK) continue;
59 3 }
60 2
61 2 if(cardtype == MF1_S50)
62 2 {
63 3 if(mifs_authentication(KEYA,5)!=0) continue;
64 3 databuf[0]=0x10;
65 3 databuf[4]=~0x10;
66 3 databuf[8]=0x10;
67 3 for(i=1;i<4;i++)
68 3 {
69 4 databuf[i]=0x00;
70 4 databuf[4+i]=0xff;
71 4 databuf[8+i]=0x00;
72 4 }
73 3 databuf[12]=0x14;
74 3 databuf[13]=~0x14;
75 3 databuf[14]=0x14;
76 3 databuf[15]=~0x14;
77 3 if(mifs_write(0x14,databuf)!=0) continue;
78 3 databuf[0]=0;
79 3 if(mifs_read(0x14,databuf)!=0) continue;
80 3 value=1;
81 3 if(mifs_value(PICC_DECREMENT,0x14,&value,0x15)!=0) continue;
82 3 if(mifs_read(0x15,databuf)!=0) continue;
83 3 if(mifs_value(PICC_INCREMENT,0x14,&value,0x16)!=0) continue;
84 3 if(mifs_read(0x16,databuf)!=0) continue;
85 3 }
86 2 else if(cardtype == MF1_S70)
87 2 {
88 3 if(mifs_authentication2(KEYA,39,5)!=0) continue;
89 3 if(mifs_read(240,databuf)!=0) continue;
90 3 }
91 2 else if(cardtype == MF0_ULIGHT)
92 2 {
93 3 databuf[0]=0x11;
94 3 databuf[1]=0x22;
95 3 databuf[2]=0x33;
96 3 databuf[3]=0x44;
97 3 if(mifs_ULwrite(15,databuf)!=0) continue;
98 3 databuf[0]=0x00;
99 3 databuf[1]=0x00;
100 3 databuf[2]=0x00;
101 3 databuf[3]=0x00;
102 3 if(mifs_read(15,databuf)!=0) continue;
103 3 }
104 2 else if(cardtype == MF1_LIGHT)
105 2 {
106 3 if(mifs_authKey(KEYA,2,Nkey_b)!=0) continue;
107 3 databuf[0]=0x10;
108 3 databuf[1]=0x00;
109 3 databuf[2]=0xef;
110 3 databuf[3]=0xff;
111 3 if(mifs_write(4,databuf)!=0) continue;
112 3 databuf[0]=0xff;
113 3 databuf[1]=0xff;
114 3 databuf[2]=0xff;
115 3 databuf[3]=0xff;
116 3 if(mifs_write(5,databuf)!=0) continue;
117 3 if(mifs_read(4,databuf)!=0) continue;
C51 COMPILER V7.09 MAIN 08/18/2006 08:26:15 PAGE 3
118 3 if(databuf[0]!=~databuf[2] || databuf[1]!=~databuf[3])
119 3 continue;
120 3 value=1;
121 3 if(mifs_valuedebit(0xc0,4,&value)!=0) continue;
122 3 if(mifs_read(4,databuf)!=0) continue;
123 3 }
124 2
125 2 mifs_halt();
126 2 // mifs_reset(1);
127 2
128 2 // i=mifs_write_E2(0x30,16,databuf);
129 2 // if(i!=0) continue;
130 2 mifs_clr_control_bit();
131 2 mifs_buzzer(250,20);
132 2 while(mifs_set_control_bit()!=0);
133 2 }
134 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 659 ----
CONSTANT SIZE = 12 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 4
IDATA SIZE = 32 28
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -