C51 COMPILER V9.54   KEY                                                                   12/03/2024 15:15:45 PAGE 1   


C51 COMPILER V9.54, COMPILATION OF MODULE KEY
OBJECT MODULE PLACED IN .\Objects\key.obj
COMPILER INVOKED BY: C:\Keil_v5\C51\BIN\C51.EXE public\key.c OPTIMIZE(8,SPEED) BROWSE INCDIR(.\public) DEBUG OBJECTEXTEN
                    -D PRINT(.\Listings\key.lst) OBJECT(.\Objects\key.obj)

line level    source

   1          #include "key.h"
   2          
   3          
   4          uint8_t KEY = 0;
   5          uint8_t TEMP = 26; //温度
   6          extern uint8_t IDLE_FLG;
   7          void key_init(void)
   8          {
   9   1              GPIO_INPUT(P1, 0, 1);
  10   1              GPIO_INPUT(P1, 1, 1);
  11   1              GPIO_INPUT(P1, 2, 1);
  12   1              GPIO_INPUT(P1, 3, 1);
  13   1              EA = 1;
  14   1              IEN2 |= 0x01;
  15   1              INTCTRL |= 0x10; //INT4下降沿产生中断
  16   1              INTEN = 0x0F;    //P1.0 1 2 3外部中断使能
  17   1              
  18   1        KEY = 0;
  19   1        TEMP = 26; //温度
  20   1      }
  21          
  22          
  23          void KEY_Scan() interrupt 12
  24          {
  25   1              
  26   1              switch(INTFLG)
  27   1              {
  28   2                      case 0x01: //开机       
  29   2                              IEN2 &= 0xFE; //禁止外部中断使能
  30   2                              INTFLG = 0x00;
  31   2                              delay(30);                                                                      //按键消抖
  32   2                              if ((P1 & 0x01) == 0x00 && KEY == 0)
  33   2                              {       
  34   3                                      KEY = 1;
  35   3                                      REM_Test();
  36   3                              }       
  37   2                              else    
  38   2                                      IDLE_FLG = 1;
  39   2                              break;
  40   2                      case 0x02: //关机
  41   2                              IEN2 &= 0xFE; //禁止外部中断使能
  42   2                              INTFLG = 0x00;
  43   2                              delay(30);      
  44   2                              if ((P1 & 0x02) == 0x00 && KEY != 0)
  45   2                              {
  46   3                                      KEY = 0;
  47   3                                      REM_Test();
  48   3                              }               
  49   2                              else 
  50   2                                      IDLE_FLG = 1;
  51   2                              break;
  52   2                      case 0x04: //加         
  53   2                              IEN2 &= 0xFE; //禁止外部中断使能
  54   2                              INTFLG = 0x00;  
C51 COMPILER V9.54   KEY                                                                   12/03/2024 15:15:45 PAGE 2   

  55   2                              delay(30);              
  56   2                              if ((P1 & 0x04) == 0x00 && (TEMP < 30)&& KEY != 0)
  57   2                              {
  58   3                                      TEMP++;
  59   3                                      REM_Test();
  60   3                              }
  61   2                              else 
  62   2                                      IDLE_FLG = 1;
  63   2                              break;
  64   2                      case 0x08: //减
  65   2                              INTFLG = 0x00;
  66   2                              IEN2 &= 0xFE; //禁止外部中断使能
  67   2                              delay(30);      
  68   2                              if ((P1 & 0x08) == 0x00 && (TEMP > 17)&& KEY != 0)
  69   2                              {
  70   3                                      TEMP--;
  71   3                                      REM_Test();
  72   3                              }
  73   2                              else 
  74   2                                      IDLE_FLG = 1;
  75   2                              break;
  76   2                      default:
  77   2                              INTFLG = 0x00;  
  78   2                              IDLE_FLG = 1;
  79   2                              break;                          
  80   2              }
  81   1              
  82   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    255    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      2    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
