⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hello.lst

📁 使用单片机进行按键操作
💻 LST
字号:
C51 COMPILER V8.02   HELLO                                                                 02/25/2006 23:31:05 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE HELLO
OBJECT MODULE PLACED IN HELLO.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE HELLO.C BROWSE DEBUG OBJECTEXTEND

line level    source

   1          /*------------------------------------------------------------------------------
   2          HELLO.C
   3          
   4          Copyright 1995-2005 Keil Software, Inc.
   5          ------------------------------------------------------------------------------*/
   6          
   7          #include <REG52.H>                /* special function register declarations   */
   8          /* for the intended 8051 derivative         */
   9          
  10          #include <stdio.h>                /* prototype declarations for I/O functions */
  11          #include <stdlib.h>                      /* standard library .h-file          */
  12          #include <ctype.h>                       /* character functions               */
  13          
  14          
  15          #ifdef MONITOR51                         /* Debugging with Monitor-51 needs   */
              char code reserve [3] _at_ 0x23;         /* space for serial interrupt if     */
              #endif                                   /* Stop Exection with Serial Intr.   */
  18          
  19          
  20          
  21          //定义按健
  22                  sbit K1 = P3^4;
  23                  sbit K2 = P3^5;
  24          
  25                  sbit LED = P1^0;
  26          
  27          xdata unsigned char sendstr[32]  _at_ 0x1000; 
  28          
  29          
  30          //延时
  31          void delay(unsigned int i)
  32          {        
  33   1                
  34   1              
  35   1      }
*** WARNING C280 IN LINE 31 OF HELLO.C: 'i': unreferenced local variable
  36          
  37          
  38          
  39          /*------------------------------------------------
  40          The main C function.  Program execution starts
  41          here after stack initialization.
  42          ------------------------------------------------*/
  43          void main (void) {
  44   1      
  45   1              char i;  
  46   1      
  47   1      
  48   1      
  49   1      #ifndef MONITOR51
  50   1              SCON  = 0x50;                   /* SCON: mode 1, 8-bit UART, enable rcvr  101 0000    */
  51   1              RCAP2H = 0xFF;
  52   1              TH2   = 0xff;                
  53   1              RCAP2L =0xBF;
  54   1              TL2  =  0xFB;
C51 COMPILER V8.02   HELLO                                                                 02/25/2006 23:31:05 PAGE 2   

  55   1              T2CON = 0x34;                       //0011 0100
  56   1              //TR1   = 1;                  /* TR1:  timer 1 run                          */
  57   1              TI    = 1;                  /* TI:   set TI to send first char of UART    */
  58   1              ES  =0;
  59   1              EA =1;
  60   1      #endif
  61   1      
  62   1      
  63   1              /*------------------------------------------------
  64   1              Note that an embedded program never exits (because
  65   1              there is no operating system to return to).  It
  66   1              must loop and execute forever.
  67   1              ------------------------------------------------*/
  68   1      
  69   1                 //设置
  70   1                      K1=1;
  71   1                      K2=1;
  72   1                      LED =1;
  73   1                
  74   1                while (1) {
  75   2                  //P1 ^= 0x01;                   /* Toggle P1.0 each time we print */
  76   2                      
  77   2                      
  78   2                      //如果K1为0,按下,灯灭  
  79   2                      if(K1==0)
  80   2                              {
  81   3                                      printf("K1==0");
  82   3                                      LED =0;
  83   3                              }
  84   2                      
  85   2                      //如果K2为0
  86   2                      if(K2==0)
  87   2                              {
  88   3                                      //LED = 1;              //按下,灯亮
  89   3                                      LED ^=1;           //K2按下,取反
  90   3                                      printf("K2==0");
  91   3                                      
  92   3                              }
  93   2                      
  94   2                }
  95   1      
  96   1      
  97   1      
  98   1      }
*** WARNING C280 IN LINE 45 OF HELLO.C: 'i': unreferenced local variable
  99          
 100          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     68    ----
   CONSTANT SIZE    =     12    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----       3
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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