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

📄 串口通讯.lst

📁 很实用的单片机例程
💻 LST
字号:
C51 COMPILER V7.06   __口蚠裚                                                              04/14/2008 10:22:26 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE __口蚠裚
OBJECT MODULE PLACED IN 串口通讯.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE 串口通讯.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          //打开串口调试程序,将波特率设置为2400,无奇偶校验
   2          
   3          
   4          #include <REG52.H>                /* special function register declarations   */
   5                                            /* for the intended 8051 derivative         */
   6          
   7          #include <stdio.h>                /* prototype declarations for I/O functions */
   8          
   9          
  10          #ifdef MONITOR51                         /* Debugging with Monitor-51 needs   */
              char code reserve [3] _at_ 0x23;         /* space for serial interrupt if     */
              #endif                                   /* Stop Exection with Serial Intr.   */
  13                                                   /* is enabled                        */
  14          sbit KEY=P3^2;
  15          
  16          void delay(unsigned int U)
  17          {
  18   1       while(--U);
  19   1      }
  20          /*------------------------------------------------
  21          The main C function.  Program execution starts
  22          here after stack initialization.
  23          ------------------------------------------------*/
  24          void main (void)
  25          {
  26   1      
  27   1      /*------------------------------------------------
  28   1      Setup the serial port for 1200 baud at 11.0592MHz.
  29   1      ------------------------------------------------*/
  30   1      #ifndef MONITOR51
  31   1          SCON  = 0x50;                       /* SCON: mode 1, 8-bit UART, enable rcvr      */
  32   1          TMOD |= 0x20;               /* TMOD: timer 1, mode 2, 8-bit reload        */
  33   1          TH1   = 0xf3;                /* TH1:  reload value for 2400 baud @ 12MHz   */
  34   1          TR1   = 1;                  /* TR1:  timer 1 run                          */
  35   1          TI    = 1;                  /* TI:   set TI to send first char of UART    */
  36   1      #endif
  37   1      
  38   1      /*------------------------------------------------
  39   1      Note that an embedded program never exits (because
  40   1      there is no operating system to return to).  It
  41   1      must loop and execute forever.
  42   1      ------------------------------------------------*/
  43   1        while (1) 
  44   1          {
  45   2          
  46   2          if(!KEY)
  47   2             {
  48   3              delay(10000);
  49   3              if(!KEY)
  50   3                {
  51   4                       printf ("This programer test ok!\n");  
  52   4                       printf ("12:25:26\n");  
  53   4                 }
  54   3                      }
  55   2          }
C51 COMPILER V7.06   __口蚠裚                                                              04/14/2008 10:22:26 PAGE 2   

  56   1      }
  57          


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


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

⌨️ 快捷键说明

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