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

📄 hello.lst

📁 单片机测试串口通信程序
💻 LST
字号:
C51 COMPILER V8.02   HELLO                                                                 03/04/2006 19:00:19 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          #include <intrins.h>
  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          sbit P12MOTO=P1^2;
  28          
  29          sbit P33=P3^3;
  30          
  31          
  32          
  33          
  34          //延时
  35          void delay(unsigned int n)
  36          {        
  37   1        unsigned int i;
  38   1         for(i=0;i<n;i++)
  39   1         _nop_;
*** WARNING C275 IN LINE 39 OF HELLO.C: expression with possibly no effect
  40   1      
  41   1      }
  42          
  43           //串口中断
  44          void serial0(void) interrupt 4
  45          {
  46   1              unsigned char tmp;
  47   1      
  48   1              EA=0;  //关中断
  49   1      
  50   1              if(RI)           //处理接收中断
  51   1              {
  52   2      
  53   2                      tmp=SBUF;
  54   2                      printf("%bu",tmp);
C51 COMPILER V8.02   HELLO                                                                 03/04/2006 19:00:19 PAGE 2   

  55   2      
  56   2                      RI=0;
  57   2              }
  58   1              if(TI)          //处理发送中断
  59   1              {
  60   2      
  61   2                      
  62   2                      TI=0;
  63   2              }
  64   1      
  65   1          EA=1;
  66   1      }
  67          
  68          
  69          /*------------------------------------------------
  70          The main C function.  Program execution starts
  71          here after stack initialization.
  72          ------------------------------------------------*/
  73          void main (void) {
  74   1      
  75   1              unsigned int i;  
  76   1      
  77   1      
  78   1      #ifndef MONITOR51
  79   1              SCON  = 0x50;                   /* SCON: mode 1, 8-bit UART, enable rcvr  101 0000    */
  80   1              RCAP2H = 0xFF;
  81   1              TH2   = 0xff;                
  82   1              RCAP2L =0xBF;
  83   1              TL2  =  0xFB;
  84   1              T2CON = 0x34;                       //0011 0100
  85   1              //TR1   = 1;                  /* TR1:  timer 1 run                          */
  86   1              //TI    = 1;                  /* TI:   set TI to send first char of UART    */
  87   1              ES  =1;                            //允许串行中断
  88   1              EA =1;
  89   1      #endif
  90   1      
  91   1      
  92   1              /*------------------------------------------------
  93   1              Note that an embedded program never exits (because
  94   1              there is no operating system to return to).  It
  95   1              must loop and execute forever.
  96   1              ------------------------------------------------*/
  97   1      
  98   1              //设置
  99   1              K1=1;
 100   1              K2=1;
 101   1              LED =1;  
 102   1      
 103   1      
 104   1      }
*** WARNING C280 IN LINE 75 OF HELLO.C: 'i': unreferenced local variable
 105          
 106          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    130    ----
   CONSTANT SIZE    =      4    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----       2
   IDATA SIZE       =   ----    ----
C51 COMPILER V8.02   HELLO                                                                 03/04/2006 19:00:19 PAGE 3   

   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 + -