📄 ear.lst
字号:
C51 COMPILER V6.21 EAR 09/29/2004 23:54:05 PAGE 1
C51 COMPILER V6.21, COMPILATION OF MODULE EAR
OBJECT MODULE PLACED IN ear.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE Source\ear.c OPTIMIZE(SIZE) DEBUG OBJECTEXTEND PRINT(.\ear.lst) OBJECT(ear.
-obj)
stmt level source
1 /*******************************Sheena**************************************/
2 #include <stdio.h>
3 #include <string.h>
4 //#include "stdlib\stdlib.h"
5 #include "delay\delay.h"
6 //#include "string\string.h"
7 #include "keyboard\keyboard.h"
8 #include "date\date.h"
9 #include "time\time.h"
10 #include "2x16lcd\2x16lcd.h"
11
12 sbit BUZZER = 0x92;
13 sfr AUXR = 0x8E;
14
15 #define ENABLE_ONCHIP_XRAM() AUXR = AUXR & 0xFD
16 #define ENABLE_OFFCHIP_XRAM() AUXR = AUXR | 0x02
17
18 #define DISABLE_ONCHIP_XRAM() ENABLE_OFFCHIP_XRAM()
19 #define DISABLE_OFFCHIP_XRAM() ENABLE_ONCHIP_XRAM()
20
21 #define kbhit() (RI)
22
23 #define RESET_DATABASE 'R'
24 #define RECORD_COUNTS 'C'
25 #define ATTENDANCE_RECORDS 'A'
26 #define EXIT 'E'
27 #define SET_DATE 'D'
28 #define SET_TIME 'T'
29
30 /*Application specific code*/
31 #define BARCODE_LENGTH 14
32
33 typedef struct
34 {
35 char barcode[14];
36 struct date d;
37 struct time t;
38 }AttendanceRecord;
39
40 AttendanceRecord xdata attendance_records[1600];
41 int xdata record_counts;
42 char command;
43 sbit P1_1 = 0x91;
44
45 char *readbarcode(char *barcode, int counts)
46 {
47 1 int i;
48 1
49 1 for(i = 0; i < counts; i++)
50 1 {
51 2 *(barcode + i) = getkey();
52 2 }
53 1
54 1 *(barcode + i) = '\0';
C51 COMPILER V6.21 EAR 09/29/2004 23:54:05 PAGE 2
55 1
56 1 return barcode;
57 1 }
58
59 void timer0() interrupt 1
60 {
61 1 int i;
62 1 struct date d;
63 1 struct time t;
64 1 char command_str[10];
65 1
66 1 if(kbhit())
67 1 {
68 2 ET0 = 0;
69 2
70 2 // while(1)
71 2 {
72 3 printf("Enter command : ");
73 3 scanf("%s", command_str);
74 3 //command = getchar();
75 3 //printf("You entered %c\n", command);
76 3
77 3 command = command_str[0];
78 3
79 3 if(command == SET_DATE)
80 3 {
81 4 //printf("Enter date : ");
82 4 datesetdate(&d);
83 4 }
84 3
85 3 if(command == SET_TIME)
86 3 {
87 4 timesettime(&t);
88 4 }
89 3
90 3 if(command == RESET_DATABASE)
91 3 {
92 4 record_counts = 0;
93 4 }
94 3
95 3 if(command == RECORD_COUNTS)
96 3 {
97 4 printf("Record counts : %d\n", record_counts);
98 4 }
99 3
100 3 if(command == ATTENDANCE_RECORDS)
101 3 {
102 4 for(i = 0; i < record_counts; i++)
103 4 {
104 5 printf("%s %#x/%#x %#x:%#x\n",
105 5 attendance_records[i].barcode,
106 5 attendance_records[i].d.day,
107 5 attendance_records[i].d.mon,
108 5 attendance_records[i].t.min,
109 5 attendance_records[i].t.hour);
110 5 }
111 4 }
112 3 }
113 2
114 2 ET0 = 1;
115 2 }
116 1 }
C51 COMPILER V6.21 EAR 09/29/2004 23:54:05 PAGE 3
117
118 void inittimer0()
119 {
120 1 TMOD = (TMOD & 0xF0) | 0x01;
121 1 ET0 = 1;
122 1 TR0 = 1;
123 1 EA = 1;
124 1 }
125
126 void main()
127 {
128 1 char barcode[15];
129 1 //int i;
130 1
131 1 SCON = 0x50;
132 1 PCON &= 0x7F;
133 1 TMOD &= 0xCF;
134 1 TMOD |= 0x20;
135 1 TH1 = 0xFD;
136 1 TR1 = 1;
137 1 TI = 1;
138 1
139 1 DISABLE_ONCHIP_XRAM();
140 1
141 1 init2x16lcd();
142 1 clearlcd();
143 1
144 1 BUZZER = 0;
145 1 delay(25000);
146 1 BUZZER = 1;
147 1 delay(25000);
148 1 BUZZER = 0;
149 1 delay(25000);
150 1 BUZZER = 1;
151 1
152 1 while(1)
153 1 {
154 2 clearlcd();
155 2 gotoxy(1 , 1);
156 2 __puts("* JBB Sof Tech *");
157 2 gotoxy(1, 2);
158 2 __puts("Swap your card");
159 2
160 2 //if(keypressed())
161 2 {
162 3 BUZZER = 1;
163 3 inittimer0();
164 3 readbarcode(barcode, BARCODE_LENGTH);
165 3 barcode[13] = 0;
166 3 if(strlen(barcode) < 12)
167 3 {
168 4 clearlcd();
169 4 gotoxy(1, 1);
170 4 __puts(barcode);
171 4 gotoxy(1, 2);
172 4 __puts("Invalid card");
173 4 BUZZER = 0;
174 4 }
175 3 else
176 3 {
177 4 clearlcd();
178 4 gotoxy(1, 1);
C51 COMPILER V6.21 EAR 09/29/2004 23:54:05 PAGE 4
179 4 __puts(barcode);
180 4 gotoxy(1, 2);
181 4 __puts("Valid card");
182 4 //printf("Barcode : %s\n", barcode);
183 4
184 4 strcpy(attendance_records[record_counts].barcode, barcode);
185 4 dategetdate(&today);
186 4 attendance_records[record_counts].d = today;
187 4 timegettime(&now);
188 4 attendance_records[record_counts].t = now;
189 4
190 4 record_counts++;
191 4 }
192 3
193 3 delay(25000);
194 3 //delay(25000);
195 3 //delay(25000);
196 3 //delay(25000);
197 3 }
198 2 }
199 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1908 ----
CONSTANT SIZE = 153 ----
XDATA SIZE = 28802 ----
PDATA SIZE = ---- ----
DATA SIZE = 9 59
IDATA SIZE = ---- ----
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 + -