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

📄 hello.lst

📁 早期用过的一个485通信程序
💻 LST
字号:
C51 COMPILER V7.10   HELLO                                                                 11/18/2006 21:15:14 PAGE 1   


C51 COMPILER V7.10, COMPILATION OF MODULE HELLO
OBJECT MODULE PLACED IN hello.OBJ
COMPILER INVOKED BY: d:\Program Files\Keil\C51\BIN\C51.EXE hello.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          /*------------------------------------------------------------------------------
   2          HELLO.C
   3          
   4          Copyright 1995-1999 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          
  12          
  13          #ifdef MONITOR51                         /* Debugging with Monitor-51 needs   */
              char code reserve [3] _at_ 0x23;         /* space for serial interrupt if     */
              #endif                                   /* Stop Exection with Serial Intr.   */
  16                                                   /* is enabled                        */
  17          bit senenb = 0;
  18          int i_aT,i_bT;
  19          unsigned char Tem;
  20          
  21          sbit rs485_com = P3^2;
  22          /*------------------------------------------------
  23          The main C function.  Program execution starts
  24          here after stack initialization.
  25          ------------------------------------------------*/
  26          void delay(unsigned char i);
  27          
  28          void ser_int (void) interrupt 4 using 1
  29          {
  30   1       if(TI == 1)
  31   1       {
  32   2              TI = 0;
  33   2              senenb = 0;
  34   2       }
  35   1      
  36   1       if(RI == 1)
  37   1       {
  38   2              RI = 0;
  39   2              Tem = SBUF;
  40   2              senenb = 1;
  41   2      
  42   2       }
  43   1      }
  44          void main (void) {
  45   1      
  46   1      /*------------------------------------------------
  47   1      Setup the serial port for 1200 baud at 16MHz.
  48   1      ------------------------------------------------*/
  49   1      #ifndef MONITOR51
  50   1          SCON  = 0x50;                       /* SCON: mode 1, 8-bit UART, enable rcvr      */
  51   1          TMOD |= 0x20;               /* TMOD: timer 1, mode 2, 8-bit reload        */
  52   1          TH1   = 0xfd;                /* TH1:  reload value for 1200 baud @ 16MHz   */
  53   1          TR1   = 1;                  /* TR1:  timer 1 run                          */
  54   1      //    TI    = 1;                  /* TI:   set TI to send first char of UART    */
  55   1              IE    = 0x90;
C51 COMPILER V7.10   HELLO                                                                 11/18/2006 21:15:14 PAGE 2   

  56   1      #endif
  57   1      /*********************************************************************************************************
  58   1      **
  59   1      **                                  (c) Copyright 2004-2006
  60   1      **                                    All Rights Reserved
  61   1      **
  62   1      **
  63   1      **                                    版权所有:朗顿科技
  64   1      **                                   http://www.ldmcu.com
  65   1      **
  66   1      ********************************************************************************************************/
  67   1      
  68   1      /*------------------------------------------------
  69   1      Note that an embedded program never exits (because
  70   1      there is no operating system to return to).  It
  71   1      must loop and execute forever.
  72   1      ------------------------------------------------*/
  73   1        rs485_com = 0;
  74   1        
  75   1        while(1)
  76   1        {     
  77   2              if(senenb == 1)
  78   2              {
  79   3                rs485_com = 1;
  80   3                SBUF = Tem;
  81   3                delay(100);
  82   3              }
  83   2              else
  84   2              {
  85   3                rs485_com = 0;
  86   3              }
  87   2        }
  88   1      }
  89          
  90          void delay(unsigned char i)
  91          {
  92   1              unsigned char j;
  93   1              for(i; i > 0; i--)
  94   1                      for(j = 200; j > 0; j--);
  95   1      }
  96          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     67    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      5    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      1    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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