display.lst

来自「一个基于C51开发的计价秤」· LST 代码 · 共 1,591 行 · 第 1/5 页

LST
1,591
字号
  32      =1          BYTE shiftval;
C51 COMPILER V7.50   DISPLAY                                                               05/27/2006 14:01:05 PAGE 6   

  33      =1          BYTE memval;
  34      =1          BYTE modeval;
  35      =1          BYTE funval;
  36      =1  }KEYRET;
  37      =1  
  38      =1  /***UNIONs, STRUCTUREs***/
  39      =1  typedef union UNION_LONG {      // byte-addressable LONG
  40      =1    DWORD L;
  41      =1    BYTE B[4];
  42      =1  } UNION_LONG;
  43      =1  
  44      =1  typedef union UNION_FLOAT {     // byte-addressable LONG
  45      =1    FLOAT F;
  46      =1    BYTE B[4];
  47      =1  } UNION_FLOAT;
  48      =1  
  49      =1  typedef union UNION_INT {               // byte-addressable INT
  50      =1    WORD I;
  51      =1    BYTE B[2];
  52      =1  } UNION_INT;
  53      =1  
  54      =1  /*****11.0592MHZ*****/
  55      =1  #define V_TMOD 0x11
  56      =1  #define V_TH0 0x4c      //50ms
  57      =1  #define V_TL0 0x0f
  58      =1  //#define V_TH1 0xb8//20ms
  59      =1  //#define V_TL1 0x00
  60      =1  #define V_TH1 0xdc      //10ms
  61      =1  #define V_TL1 0x00
  62      =1  #define V_TH2 0xff  //9600 bps 
  63      =1  #define V_TL2 0xdb 
  64      =1  //#define SEC 50
  65      =1  #define SEC 100
  66      =1  #define N 1 
  67      =1  
  68      =1  #define LIGHT P3_7
  69      =1  #define AC_DECT P1_2
  70      =1  #define BAT_DECT P3_3
  71      =1  #define FALSE 0
  72      =1  #define TRUE 1
  73      =1  #define PAND 0
  74      =1  #define FOOKTIN 1
  75      =1  #define LCD_MODE 0x08           //display(1:4,1/3)
  76      =1  #define LCD_GLITTER 0x00        //off
  77      =1  #define MAX_RECORD 0xbb8        //3000
  78      =1  #define PLU_LEN 22
  79      =1  #define TABLE_LEN 64
  80      =1  #define RECORD_LEN 15
  81      =1  /**********mode**********/
  82      =1  #define Input_code_mode 1
  83      =1  #define Calibration_mode 2
  84      =1  #define Initialization_mode 3
  85      =1  #define Sales_mode 4
  86      =1  #define Total_mode 5
  87      =1  #define Payback_mode 6
  88      =1  #define PLU_Setup_mode 7
  89      =1  #define Time_Setup_mode 8
  90      =1  #define Beep_and_Light_Setup_mode 9
  91      =1  #define Calculator_mode 10
  92      =1  #define Reports_mode 11
  93      =1  #define Download_mode 12
  94      =1  #define Power_down_mode 13
C51 COMPILER V7.50   DISPLAY                                                               05/27/2006 14:01:05 PAGE 7   

  95      =1  #define Print_Cancel_mode 14
  96      =1  /**********state**********/
  97      =1  #define WEIGHING 1
  98      =1  #define NON_WEIGHING 2
  99      =1  #define PAYBACK 3
 100      =1  
 101      =1  #define PLU_EDIT 1
 102      =1  #define PLU_SAVE 2
 103      =1  
 104      =1  #define SET_BEEP 1
 105      =1  #define SET_LIGHT 2
 106      =1  
 107      =1  #define MENU_1 1
 108      =1  #define MENU_1_1 11
 109      =1  #define MENU_1_2 12
 110      =1  #define MENU_1_2_1 121
 111      =1  #define MENU_1_2_2 122
 112      =1  #define MENU_1_2_2_0 1221
 113      =1  #define MENU_1_3 13
 114      =1  #define MENU_1_4 14
 115      =1  
 116      =1  #define MENU_2 2
 117      =1  #define MENU_2_1 21
 118      =1  #define MENU_2_2 22
 119      =1  #define MENU_2_2_1 221
 120      =1  #define MENU_2_2_2 222
 121      =1  #define MENU_2_2_2_0 2221
 122      =1  #define MENU_2_3 23
 123      =1  
 124      =1  #define MENU_3 3
 125      =1  #define MENU_3_1 31
 126      =1  #define MENU_3_2 32
 127      =1  #define MENU_3_2_1 321
 128      =1  #define MENU_3_2_2 322
 129      =1  #define MENU_3_2_2_0 3221
 130      =1  #define MENU_3_3 33
 131      =1  
 132      =1  #define EDIT_YEAR 1
 133      =1  #define EDIT_MONTH 2
 134      =1  #define EDIT_DAY 3
 135      =1  #define EDIT_HOUR 4
 136      =1  #define EDIT_MINUTE 5
 137      =1  #define EDIT_SECOND 6
 138      =1  
 139      =1  /**********sales type**********/
 140      =1  #define PW 1
 141      =1  #define PN 2
 142      =1  #define MW 3
 143      =1  #define MN 4
 144      =1  #define DELE 0xaa
 145      =1  
 146      =1  /**********print type***********/
 147      =1  #define PW 1
 148      =1  #define PN 2
 149      =1  #define MW 3
 150      =1  #define MN 4
 151      =1  #define TOTAL 5
 152      =1  
 153      =1  /**********report type**********/
 154      =1  #define TOTAL_ALL_MONEY 1
 155      =1  #define TOTAL_ALL_PLU_MONEY 2
 156      =1  #define TOTAL_SEL_PLU_MONEY 3
C51 COMPILER V7.50   DISPLAY                                                               05/27/2006 14:01:05 PAGE 8   

 157      =1  #define TOTAL_ALL_MANUL_MONEY 4
 158      =1  #define TOTAL_ALL_NUMBER_MONEY 5
 159      =1  #define TOTAL_ALL_WEIGHT 6
 160      =1  #define TOTAL_ALL_PLU_WEIGHT 7
 161      =1  #define TOTAL_SEL_PLU_WEIGHT 8
 162      =1  #define TOTAL_ALL_MANUL_WEIGHT 9
 163      =1  #define TOTAL_ALL_NUMBER 10
 164      =1  #define TOTAL_ALL_PLU_NUMBER 11
 165      =1  #define TOTAL_SEL_PLU_NUMBER 12
 166      =1  #define TOTAL_ALL_MANUL_NUMBER 13
 167      =1  
 168      =1  /********operate status********/
 169      =1  #define ADD 1
 170      =1  #define SUM 2
 171      =1  #define PAY 3
 172      =1  
 173      =1  /********eeprom address********/
 174      =1  #define EEPROM_ID 0
 175      =1  #define Option_Param_address 2
 176      =1  #define Graduation_Grade_address 3
 177      =1  #define Graduation1_address 5
 178      =1  #define Graduation2_address 6
 179      =1  #define Max_Capacity_address 7
 180      =1  #define Initial_Zero_Setting_limit_address 9
 181      =1  #define Zero_Setting_and_Zero_Tracking_limit_address 10
 182      =1  #define Zero_Stable_count_address 11
 183      =1  #define Zero_Stable_times_address 13
 184      =1  #define Weight_Stable_count_address 14
 185      =1  #define Weight_Stable_times_address 16
 186      =1  #define Err1_Timeout_address 17
 187      =1  #define Local_Height_address 18
 188      =1  #define Local_Latitude_address 20
 189      =1  #define Destination_Height_address 21
 190      =1  #define Destination_Latitude_address 23
 191      =1  #define Soft_Ver_address 24
 192      =1  #define Cal_counts_address 26
 193      =1  #define Password_address 27
 194      =1  #define Cal_Zero_limit_count_address 30
 195      =1  #define Cal_One_count_address 36 
 196      =1  #define Cal_Zero_count_address 40
 197      =1  #define Cal_Weight_count_address 44 
 198      =1  #define Logo_address 48            
 199      =1  #define PLU_DATA_ADR 0x40
 200      =1  #define RECORD_DATA_ADR 0x2600
 201      =1  
 202      =1  /********report save address********/
 203      =1  #define PLU_no_Save_address 1
 204      =1  #define Unit_Price_Save_address 3
 205      =1  #define Weight_Save_address 6
 206      =1  #define Quantity_Save_address 6
 207      =1  #define Total_Price_Save_address 9
   9          
  10          #define SEG_A 0x80                                                                              /*a segment*/
  11          #define SEG_B 0x20                                                                              /*b segment*/
  12          #define SEG_C 0x40                                                                              /*c segment*/
  13          #define SEG_D 0x01                                                                              /*d segment*/
  14          #define SEG_E 0x04                                                                              /*e segment*/
  15          #define SEG_F 0x08                                                                              /*f segment*/
  16          #define SEG_G 0x02                                                                              /*g segment*/
  17          #define SEG_DP 0x10                                                                             /*dp segment*/
  18          
  19          #define CHAR_0 SEG_A+SEG_B+SEG_C+SEG_D+SEG_E+SEG_F              /*0*/
C51 COMPILER V7.50   DISPLAY                                                               05/27/2006 14:01:05 PAGE 9   

  20          #define CHAR_1 SEG_B+SEG_C                                                              /*1*/
  21          #define CHAR_2 SEG_A+SEG_B+SEG_D+SEG_E+SEG_G                    /*2*/
  22          #define CHAR_3 SEG_A+SEG_B+SEG_C+SEG_D+SEG_G                    /*3*/
  23          #define CHAR_4 SEG_B+SEG_C+SEG_F+SEG_G                                  /*4*/
  24          #define CHAR_5 SEG_A+SEG_C+SEG_D+SEG_F+SEG_G                    /*5*/
  25          #define CHAR_6 SEG_A+SEG_C+SEG_D+SEG_E+SEG_F+SEG_G              /*6*/
  26          #define CHAR_7 SEG_A+SEG_B+SEG_C                                                /*7*/
  27          #define CHAR_8 SEG_A+SEG_B+SEG_C+SEG_D+SEG_E+SEG_F+SEG_G/*8*/
  28          #define CHAR_9 SEG_A+SEG_B+SEG_C+SEG_D+SEG_F+SEG_G              /*9*/
  29          #define CHAR_A SEG_A+SEG_B+SEG_C+SEG_E+SEG_F+SEG_G              /*A*/
  30          #define CHAR_b SEG_C+SEG_D+SEG_E+SEG_F+SEG_G                    /*b*/
  31          #define CHAR_C SEG_A+SEG_F+SEG_E+SEG_D                                  /*C*/
  32          #define CHAR_c SEG_D+SEG_E+SEG_D                                                /*c*/
  33          #define CHAR_d SEG_B+SEG_C+SEG_D+SEG_E+SEG_G                    /*d*/
  34          #define CHAR_E SEG_A+SEG_D+SEG_E+SEG_F+SEG_G                    /*E*/
  35          #define CHAR_F SEG_A+SEG_E+SEG_F+SEG_G                                  /*F*/
  36          #define CHAR_H SEG_B+SEG_C+SEG_E+SEG_F+SEG_G                    /*H*/
  37          #define CHAR_h SEG_C+SEG_E+SEG_F+SEG_G                                  /*h*/
  38          #define CHAR_o SEG_C+SEG_D+SEG_E+SEG_G                                  /*o*/
  39          #define CHAR_P SEG_A+SEG_B+SEG_E+SEG_F+SEG_G                    /*P*/
  40          #define CHAR_q SEG_A+SEG_B+SEG_C+SEG_F+SEG_G                    /*q*/
  41          #define CHAR_r SEG_E+SEG_G                                                              /*r*/
  42          #define CHAR_t SEG_D+SEG_E+SEG_F+SEG_G                                  /*t*/
  43          #define CHAR_L SEG_D+SEG_E+SEG_F                                                /*L*/
  44          #define CHAR_N SEG_A+SEG_B+SEG_C+SEG_E+SEG_F                    /*N*/
  45          #define CHAR_n SEG_C+SEG_E+SEG_G                                                /*n*/
  46          #define CHAR_U SEG_B+SEG_C+SEG_D+SEG_E+SEG_F                    /*U*/
  47          #define CHAR_y SEG_B+SEG_C+SEG_D+SEG_F+SEG_G                    /*y*/
  48          #define CHAR_NEG SEG_G                                                                  /*-*/
  49          
  50          #define BEEP_ICON 0x80
  51          #define AC_ICON 0x40
  52          #define BAT_ICON 0x20
  53          #define NET_ICON 0x08
  54          #define STA_ICON 0x04
  55          #define NEG_ICON 0x02
  56          #define ZERO_ICON 0x01 
  57          
  58          extern TIME time;
  59          extern DATE date;
  60          extern BOOL NEG_flag;
  61          extern BOOL point1_on,point2_on,point3_on;
  62          extern BYTE point1_pos,point2_pos,point3_pos;
  63          extern BYTE state;
  64          extern BYTE icon_buf;
  65          extern BYTE lcd1_buf[5];
  66          extern BYTE lcd2_buf[7];
  67          extern BYTE lcd3_buf[7];
  68          extern BYTE LCD_RAM[20];
  69          extern BOOL colon,clock_flash,logo_flag,KG_flag;
  70          
  71          extern VOID LCD_Display(BYTE driver,BYTE adr,BYTE *buf,BYTE no);
  72          
  73          static struct{
  74                  BYTE ascii;
  75                  BYTE stroke;
  76          }  const lcd_segment[30]=\
  77                  {{'0',CHAR_0},{'1',CHAR_1},{'2',CHAR_2},{'3',CHAR_3},{'4',CHAR_4},\
  78                   {'5',CHAR_5},{'6',CHAR_6},{'7',CHAR_7},{'8',CHAR_8},{'9',CHAR_9},\
  79                   {'A',CHAR_A},{'b',CHAR_b},{'c',CHAR_c},{'C',CHAR_C},{'d',CHAR_d},\
  80                   {'E',CHAR_E},{'F',CHAR_F},{'H',CHAR_H},{'o',CHAR_o},{'P',CHAR_P},\
  81                   {'q',CHAR_q},{'r',CHAR_r},{'t',CHAR_t},{'L',CHAR_L},{'N',CHAR_N},\
C51 COMPILER V7.50   DISPLAY                                                               05/27/2006 14:01:05 PAGE 10  

  82                   {'n',CHAR_n},{'U',CHAR_U},{'y',CHAR_y},{'h',CHAR_h},{'-',CHAR_NEG}};
  83          
  84          BYTE Get_Lcd_Segment(BYTE c)
  85          //find lcd segment form segment tables by char
  86          //return segment value 
  87          {
  88   1              INT8 data p=0;
  89   1              while(lcd_segment[p].ascii!=c)
  90   1              {
  91   2                      p++;
  92   2                      if(p==30)return 0;
  93   2              }
  94   1              return(lcd_segment[p].stroke);  
  95   1      }
  96          
  97          VOID Set_BEEP_Icon()
  98          {
  99   1              icon_buf|=BEEP_ICON;    
 100   1      }
 101          
 102          VOID Cls_BEEP_Icon()
 103          {
 104   1              icon_buf&=~BEEP_ICON;   
 105   1      }
 106          
 107          VOID Set_AC_Icon()
 108          {
 109   1              icon_buf|=AC_ICON;      
 110   1      }
 111          VOID Cls_AC_Icon()
 112          {
 113   1              icon_buf&=~AC_ICON;     
 114   1      }
 115          
 116          VOID Set_BAT_Icon()
 117          {
 118   1              icon_buf|=BAT_ICON;     
 119   1      }
 120          VOID Cls_BAT_Icon()
 121          {
 122   1              icon_buf&=~BAT_ICON;    
 123   1      }
 124          
 125          VOID Set_NEG_Icon()
 126          {
 127   1              icon_buf|=NEG_ICON;     
 128   1      }
 129          VOID Cls_NEG_Icon()
 130          {
 131   1              icon_buf&=~NEG_ICON;    
 132   1      }
 133          
 134          VOID Set_NET_Icon()
 135          {
 136   1              icon_buf|=NET_ICON;     
 137   1      }
 138          
 139          VOID Cls_NET_Icon()
 140          {
 141   1              icon_buf&=~NET_ICON;    

⌨️ 快捷键说明

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