📄 read4442.lst
字号:
C51 COMPILER V8.08 READ4442 10/21/2008 15:39:51 PAGE 1
C51 COMPILER V8.08, COMPILATION OF MODULE READ4442
OBJECT MODULE PLACED IN Read4442.OBJ
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE Read4442.c LARGE BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <stdio.h>
2 #include <intrins.h>
3 #include <string.h>
4 #include <ctype.h>
5 #include <setjmp.h>
6
7 //#include <reg51.h>
8 #include "AT89X52.h"
9 #include <absacc.h>
10 #include <Read4442.h>
11
12 #define BN 16 //数据个数
13 #define allow 0x0EA
14 #define address 0x08 //下位机机号
15 #define FSA_INIT 0x00
16 #define FSA_ADDRESS 0x01
17 #define FSA_DATA 0x02
18
19 uchar command_pre,command_cur;
20
21 //uhar compare_command_buffer(void);
22 uchar compare_command_buffer(void) reentrant;
23
24
25 uchar bdata flag;
26 sbit auto_flush=flag^1;
27 sbit message_disp=flag^3;
28 sbit message_flag=flag^2; //需刷新显示置位
29
30 uchar recv_state = FSA_INIT;
31 uchar recv_ctr = 0;
32
33 uchar command_buffer_cur[16]; // =
34 // {0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF};
35 uchar command_buffer_pre[16];
36
37 uchar command_buffer_OK[16] =
38 {0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0BF,0x0B4,0x1D,0x00,0x00,0x01,0x0C0,};
39
40 uchar command_buffer_Pin15ConnectPin16[16] =
41 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
42
43 uchar command_buffer_Pin4ConnectPin5[16] =
44 {0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF};
45
46 uchar command_buffer_Pin19ConnectPin20[16] =
47 {0x88,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x0FF,0x07F,0x69,0x3B};
48
49 main()
50 {
51 1 init();
52 1
53 1 message_flag = 0;
54 1 message_disp = 1;
55 1 Lcd2002Init();
C51 COMPILER V8.08 READ4442 10/21/2008 15:39:51 PAGE 2
56 1 Lcd2002Clr(1);
57 1 Lcd2002DispStr(4,1,"UC/OS-II V2.52");
58 1 Lcd2002DispCha(12, 1, ' ');
59 1 Lcd2002DispStr(13,1,"V2.52");
60 1 while(1)
61 1 {
62 2 if(message_flag == 1)
63 2 {
64 3 message_flag = 0;
65 3 message_disp = 0;
66 3 command_pre = compare_command_buffer();
67 3 message_disp = 1;
68 3 if (command_pre == command_cur)
69 3 {
70 4 auto_flush = 0;
71 4 auto_flush = 0;
72 4 }
73 3 else
74 3 {
75 4 auto_flush = 1;
76 4 command_cur = command_pre;
77 4 }
78 3 }
79 2 if (auto_flush == 1)
80 2 switch(command_cur)
81 2 {
82 3 case 0x01:
83 3 {
84 4 // EA = 0 ;
85 4 Lcd2002Clr(1);
86 4 Lcd2002Clr(2);
87 4 Lcd2002DispStr(2,2,"No SmartCard board");
88 4 auto_flush = 0;
89 4 // EA =1;
90 4 }
91 3 break;
92 3 case 0x02:
93 3 {
94 4 // EA = 0;
95 4 Lcd2002Clr(1);
96 4 Lcd2002DispStr(7,1,"Success!");
97 4 Lcd2002Clr(2);
98 4 Lcd2002DispStr(2,2,"SmartCard board OK");
99 4 auto_flush = 0;
100 4 // EA = 1;
101 4 }
102 3 break;
103 3 case 0x03:
104 3 {
105 4 // EA = 0;
106 4 Lcd2002Clr(1);
107 4 Lcd2002DispStr(1,1,"SmartCard Board Bad!");
108 4 Lcd2002Clr(2);
109 4 Lcd2002DispStr(1,2,"2 3 4 15 16 CN2:6 7!");
110 4 auto_flush = 0;
111 4 // EA = 1;
112 4 }
113 3 break;
114 3 case 0x04:
115 3 {
116 4 // EA = 0;
117 4 Lcd2002Clr(1);
C51 COMPILER V8.08 READ4442 10/21/2008 15:39:51 PAGE 3
118 4 Lcd2002DispStr(1,1,"SmartCard Board Bad!");
119 4 Lcd2002Clr(2);
120 4 Lcd2002DispStr(1,2,"Bridge:4 5 6 7 17 18");
121 4 auto_flush = 0;
122 4 // EA = 1;
123 4 }
124 3 break;
125 3 case 0x05:
126 3 {
127 4 // EA = 0;
128 4 Lcd2002Clr(1);
129 4 Lcd2002DispStr(1,1,"SmartCard Board Bad!");
130 4 Lcd2002Clr(2);
131 4 Lcd2002DispStr(3,2,"Bridge:18 19 20");
132 4 auto_flush = 0;
133 4 // EA = 1;
134 4 }
135 3 break;
136 3 default: auto_flush = 0;
137 3 break;
138 3
139 3 }
140 2 }
141 1 }
142 /*
143 void Delay10us(void)
144 {
145 _nop_();
146 _nop_();
147 _nop_();
148 _nop_();
149 // _nop_();
150 // _nop_();
151 }
152
153 void Delay5us(void)
154 {
155 _nop_();
156 _nop_();
157 // _nop_();
158 }
159 */
160
161 void init()
162 {
163 1 TMOD=0x20;
164 1 TL1=0xFd; //19200 Fosc =22.1184
165 1 TH1=0xFd;
166 1 // TL1=0xFA; //9600 Fosc =22.1184
167 1 // TH1=0xFA;
168 1 SCON=0x50;
169 1 PCON=0x00;
170 1 EA = 1;
171 1 ES = 1;
172 1 TR1=1;
173 1 }
174
175
176
177 void Lcd2002Delay(void)
178 {
179 1 INT8U i;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -