ear.lst

来自「attendace system on 8051 chipset from in」· LST 代码 · 共 582 行 · 第 1/2 页

LST
582
字号
C51 COMPILER V3.20,  SN-50202956  EAR                                                      01/08/06  01:18:00  PAGE 1   


DOS C51 COMPILER V3.20, COMPILATION OF MODULE EAR
OBJECT MODULE PLACED IN SOURCE\EAR.OBJ
COMPILER INVOKED BY: D:\EMBED\SHEKHAR\4022N216\SYSTEM\C51.EXE SOURCE\EAR.C

stmt level    source

   1          /*********************************Sheena************************************/
   2          #include "reg52\reg52.h"
   3          #include "stdlib\stdlib.h"
   4          #include "delay\delay.h"
   5          #include "string\string.h"
   6          //#include "keyboard\keyboard.h"
   7          #include "date\date.h"
   8          #include "time\time.h"
   9          //#include "128x64\128x64.h"
  10          #include "2x16LCD\2x16LCD.h"
  11          #include "bmps\JBB.h"
  12          #include "bmps\common.h"
  13          #include "bmps\clock.h"
  14          #include "bmps\calender.h"
  15          
  16          #ifndef NULL
  17          #define NULL ((void*)('\0'))
  18          #endif
  19          
  20          
  21          sbit GREEN_LED          = 0x97;
  22          sbit RED_LED            = 0x94;
  23          sbit BUZZER             = 0x92;
  24          sbit CMD_RECEIVED       = 0x96;
  25          sbit CMD_ACKNOWLEDGE    = 0x95;
  26          
  27          sbit COM_SELECT = 0xB3;
  28          
  29          #define kbhit() (RI)
  30          
  31          #define RESET_DATABASE               'R'        /* Delete all records */
  32          #define RECORD_COUNTS                'C'        /* Get record counts */
  33          #define ATTENDANCE_RECORDS           'A'        /* Get attendance records */
  34          #define FAIL_SAFE_ATTENDANCE_RECORDS 'S'        /* */
  35          #define SET_DATE                     'D'        /* Set system date */
  36          #define SET_TIME                     'T'        /* Set system time */
  37          #define GET_DATE                     'G'        /* Get system date */
  38          #define GET_TIME                     'H'        /* Get system time */
  39          #define REGISTER                     'E'        /* Register RFID */
  40          #define RUN                          'F'        /* */
  41          #define DISPLAY_RFID                 'I'        /* Identification */
  42          
  43          #define RESEND_COMMAND()             RC = 0; delay(5000); RC = 1;
  44          
  45          #define RFID_RECEIVED()    (rfid_received)
  46          #define RFID_PROCESSED()   rfid_received = 0; rfid_processed = 1;
  47          #define COMMAND_RECEIVED() (!CMD_RECEIVED)
  48          #define COMMAND_PROCESSED()     CMD_PROCESSED = 0; \
  49                                          delay(25000);      \
  50                                          CMD_PROCESSED = 1;
  51          
  52          #define PROCESS_START() GREEN_LED = 1; RED_LED = 0;
  53          #define PROCESS_END()   GREEN_LED = 0; \
  54                                  RED_LED = 1;
  55                                  
C51 COMPILER V3.20,  SN-50202956  EAR                                                      01/08/06  01:18:00  PAGE 2   

  56          #define BUZZER_ON()     BUZZER = 1;
  57          #define BUZZER_OFF()    BUZZER = 0;
  58          
  59          /* Application specific code */
  60          #define RFID_LENGTH 10
  61          #define MAX_RECORD_COUNTS 2500
  62          
  63          /* Data for serial interrupt */
  64          char rfid[15];
  65          unsigned char index = 0;
  66          char rfid_received = 0;
  67          char rfid_processed = 1;
  68          
  69          char xdata display_rfid;
  70          
  71          char cr[] = {'\n', 13, 0};
  72          
  73          typedef struct
  74          {
  75                  char rfid[14]; //14 bytes
  76                  struct date d;    //4 bytes
  77                  struct time t;    //4 bytes
  78          }AttendanceRecord;        //22 bytes
  79          
  80          AttendanceRecord xdata attendance_records[MAX_RECORD_COUNTS];
  81          int xdata record_counts;
  82          int xdata fail_safe_record_counts;
  83          
  84          char date_str[10];
  85          char time_str[10];
  86          
  87          char xdata reset_mode;
  88          
  89          void transmit(char *str);
  90          void updatescreen();
  91          
  92          /*
              char *readcommand(char *command)
              {
                      int i = 0;
                      char alpha = 0;
                      char num = 0;
              
                      CMD_ACKNOWLEDGE = 0;
              
                      while(1)
                      {
                              *(command + i) = getkey();
              
                              if(*(command + i) == '\r')break;
              
                              if(*(command + i) >= 'A' && *(command + i) <= 'Z')alpha = 1;
                              if(*(command + i) >= '0' && *(command + i) <= '9')num = 1;
              
                              if(!alpha && !num)
                              {
                                      PROCESS_START();
                                      CMD_ACKNOWLEDGE = 1;
                                      reset_mode = 0;
                                      ENABLE_WATCHDOG();
                                      while(1);
                              }
C51 COMPILER V3.20,  SN-50202956  EAR                                                      01/08/06  01:18:00  PAGE 3   

              
                              alpha = 0;
                              num = 0;
              
                              i++;
              	}
              
                      *(command + i) = '\0';
              
                      return command;
              }
              */
 130          char *readcommand(char *command)
 131          {
 132   1              /*
                      * We are using RX interrupt for receiving commands,
                      * hence the buffer and flag names are bit confusing
                      */
 136   1      
 137   1              rfid_received = 0;
 138   1              rfid_processed = 1;
 139   1      
 140   1              CMD_ACKNOWLEDGE = 0;
 141   1      
 142   1              //ENABLE_WATCHDOG();
 143   1      
 144   1              while(!RFID_RECEIVED());
 145   1      
 146   1              strstrcpy(command, rfid);
 147   1      
 148   1              rfid_received = 0;
 149   1              rfid_processed = 1;
 150   1      
 151   1              return command;
 152   1      }
 153          
 154          void lcd2x16displaystr(int x,int y,char *str)
 155          {
 156   1              gotoxy(x,y);
 157   1              puts(str);
 158   1      }
 159          
 160          void processcommand(char *cmd)
 161          {
 162   1              char str[10];
 163   1              int i;
 164   1              struct date d;
 165   1              struct time t;
 166   1      
 167   1              char command = *(cmd + 0);
 168   1              char *val = cmd + 1;
 169   1      
 170   1              //PROCESS_START();
 171   1              lcd2x16displaystr(1, 2, "Command process");
 172   1      
 173   1              if(command == GET_DATE)
 174   1              {
 175   2                      datetostr(&today, str);
 176   2                      transmit("Date : ");
 177   2                      transmit(str);
 178   2                      transmit(cr);
 179   2              }
C51 COMPILER V3.20,  SN-50202956  EAR                                                      01/08/06  01:18:00  PAGE 4   

 180   1      
 181   1              if(command == SET_DATE)
 182   1              {
 183   2                      if(val[0] != 0)
 184   2                      {
 185   3                              transmit(val);
 186   3                              transmit(cr);
 187   3                              strtodate(val, &d);
 188   3                              datesetdate(&d);
 189   3                      }
 190   2              }
 191   1      
 192   1              if(command == GET_TIME)
 193   1              {
 194   2                      timetostr(&now, str);
 195   2                      transmit("Time : ");
 196   2                      transmit(str);
 197   2                      transmit(cr);
 198   2              }
 199   1      
 200   1              if(command == SET_TIME)
 201   1              {
 202   2                      if(val[0] != 0)
 203   2                      {
 204   3                              strtotime(val, &t);
 205   3                              timesettime(&t);
 206   3                      }
 207   2              }
 208   1      
 209   1              if(command == RESET_DATABASE)
 210   1              {
 211   2                      transmit("Resetting database");
 212   2                      transmit(cr);
 213   2                      record_counts = 0;
 214   2                      fail_safe_record_counts = 0;
 215   2              }
 216   1      
 217   1              if(command == RECORD_COUNTS)
 218   1              {
 219   2                      itoa(record_counts, str, 10);
 220   2                      transmit("Record counts : ");
 221   2                      transmit(str);
 222   2                      transmit(cr);
 223   2              }
 224   1      
 225   1              if(command == ATTENDANCE_RECORDS)
 226   1              {
 227   2                      for(i = 0; i < record_counts; i++)
 228   2                      {
 229   3                              itoa(i + 1, str, 10);
 230   3                              transmit("[");                           //01
 231   3                              transmit(attendance_records[i].rfid); //10
 232   3                              transmit("     ");                       //05
 233   3                              datetostr(&attendance_records[i].d, str);  
 234   3                              str[2] = '/';                       
 235   3                              transmit(str);                          //05
 236   3                              transmit("     ");                      //05
 237   3                              timetostr(&attendance_records[i].t, str);
 238   3                              str[2] = ':';
 239   3                              transmit(str);                         //05
 240   3                              transmit("]");                         //01
 241   3                      }
C51 COMPILER V3.20,  SN-50202956  EAR                                                      01/08/06  01:18:00  PAGE 5   

 242   2              }
 243   1      
 244   1              if(command == FAIL_SAFE_ATTENDANCE_RECORDS)
 245   1              {
 246   2                      for(i = 0; i < fail_safe_record_counts; i++)
 247   2                      {
 248   3                              delay(20000);
 249   3      
 250   3                              itoa(i + 1, str, 10);
 251   3                              transmit("[");                           //01
 252   3                              transmit(attendance_records[i].rfid); //10
 253   3                              transmit("     ");                       //05
 254   3                              datetostr(&attendance_records[i].d, str);  
 255   3                              str[2] = '/';                       
 256   3                              transmit(str);                          //05
 257   3                              transmit("     ");                      //05
 258   3                              timetostr(&attendance_records[i].t, str);
 259   3                              str[2] = ':';
 260   3                              transmit(str);                         //05
 261   3                              transmit("]");                         //01
 262   3                      }
 263   2              }
 264   1      
 265   1              if(command == DISPLAY_RFID)
 266   1              {
 267   2                      display_rfid = ~display_rfid;
 268   2              }
 269   1      
 270   1              updatescreen();
 271   1              //PROCESS_END();
 272   1      }
 273          
 274          void updatescreen()

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?