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

📄 main.lst

📁 矿工定位系统单端
💻 LST
📖 第 1 页 / 共 3 页
字号:
C51 COMPILER V7.05   MAIN                                                                  03/05/2003 15:44:08 PAGE 1   


C51 COMPILER V7.05, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          #include<REG922.h>
   2          #include <absacc.h>
   3          #include "string.h"
   4          #include "intrins.h"
   5          
   6          #include "ports.h"
*** ERROR C231 IN LINE 31 OF PORTS.H: 'LED': redefinition
   7          #include "osc.h"
   8          #include "uart.h"
   9          #include "rtc.h"
  10          #include "power.h"
  11          #include "watchdogrtc.h "
  12          #include  "IAP_LITE.H"
  13          #include "crc.h"
  14          
  15          bit T_flag=0,set=0,set_ok;
  16           bit beep_flg=0;
  17          void Send_ok(unsigned char key);
  18          unsigned char ADDR,RX_addr=0,key_tem=01;
  19          unsigned char wring_send_times=0;
  20          
  21          //************************程序用的变量********************
  22          unsigned char data RXtem[7];//程序接收数据缓冲区
  23          unsigned char data RXNOM,RXSTAT=0;
  24          unsigned char data RXTimerOUT,i,RX_BEEP=0; //接收超时
  25          bit rxok;          // 接收完成标志
  26          sbit BEEP =P1^4;
*** ERROR C231 IN LINE 26 OF MAIN.C: 'BEEP': redefinition
  27          unsigned int xxxx,beep_delay=0;
  28          /****************************************************************************/
  29          union charint{
  30            unsigned char  chrX[2];
  31            unsigned int   intX;
  32            };
  33          
  34          union charint  data CRC;
  35          
  36          
  37          void Delay100ms(unsigned char x)
  38          {   
  39   1        unsigned char i,j;
  40   1        
  41   1        while(x-- != 0)
  42   1        {  
  43   2          
  44   2              for (j = 0;j < 114; j++)
  45   2              {
  46   3           if(rxok)
  47   3                {
  48   4                  rxok=0;
  49   4                      Send_ok(key_tem);
  50   4                      i=0;
  51   4                }
  52   3              for (i = 0;i < 88; i++){_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;
  53   4              _nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_(
C51 COMPILER V7.05   MAIN                                                                  03/05/2003 15:44:08 PAGE 2   

             -) ;
  54   4              _nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_(
             -) ;
  55   4              _nop_() ;_nop_() ;_nop_() ;};
  56   3              }
  57   2        }
  58   1      }
  59          /****************************************************************************/
  60          
  61          
  62          void Delay1ms(unsigned char idata  x)
  63          {   
  64   1        unsigned char i;
  65   1        
  66   1        while(x-- != 0)
  67   1        {
  68   2          if(rxok)
  69   2                {
  70   3                  rxok=0;
  71   3                      Send_ok(key_tem);
  72   3                      i=0;
  73   3                }
  74   2          for (i = 0;i < 89; i++){_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;
  75   3              _nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_(
             -) ;
  76   3              _nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_(
             -) ;
  77   3              _nop_() ;_nop_() ;_nop_() ;};
  78   2        }
  79   1      }
  80          /****************************************************************************/
  81          
  82          
  83          void Delay1msa(unsigned char idata  x)
  84          {   
  85   1        unsigned char i;
  86   1        
  87   1        while(x-- != 0)
  88   1        {
  89   2         
  90   2          for (i = 0;i < 89; i++){_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;
  91   3              _nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_(
             -) ;
  92   3              _nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_() ;_nop_(
             -) ;
  93   3              _nop_() ;_nop_() ;_nop_() ;};
  94   2        }
  95   1      }
  96          /***********************************************************************
  97          DESC:    Initializes UART for mode 1
  98                   Baudrate: 9600
  99          RETURNS: Nothing
 100          CAUTION: If interrupts are being used then EA must be set to 1
 101                   after calling this function
 102          ************************************************************************/
 103          void uart_init(void)
 104          {
 105   1        // configure UART
 106   1        // clear SMOD0
 107   1        PCON &= ~0x40;
 108   1        SCON = 0x50;
 109   1        // set or clear SMOD1
C51 COMPILER V7.05   MAIN                                                                  03/05/2003 15:44:08 PAGE 3   

 110   1        PCON &= 0x7f;
 111   1        PCON |= (0 << 8);
 112   1        SSTAT = 0x00;
 113   1      
 114   1        // enable break detect
 115   1        AUXR1 |= 0x40;
 116   1      
 117   1        // configure baud rate generator
 118   1        BRGCON = 0x00;
 119   1        BRGR0 = 0xF0;
 120   1        BRGR1 = 0x02;
 121   1        BRGCON = 0x03;
 122   1      
 123   1        // TxD = push-pull, RxD = input
 124   1        P1M1 &= ~0x01;
 125   1        P1M2 |= 0x01;
 126   1        P1M1 |= 0x02;
 127   1        P1M2 &= ~0x02;
 128   1      
 129   1        // initially not busy
 130   1      
 131   1      
 132   1        // set isr priority to 0
 133   1        IP0 &= 0xEF;
 134   1        IP0H &= 0xEF;
 135   1        // enable uart interrupt
 136   1        ES = 0;
 137   1      
 138   1      } // uart_init
 139          /***********************************************************************
 140          DESC:    Initializes the ports
 141          RETURNS: Nothing
 142          CAUTION: Call before the initialization functions of other peripherals
 143          ************************************************************************/
 144          void ports_init(void)
 145          {
 146   1        P0M1 &= 0xF0;
 147   1        P0M2 &= 0xF0;
 148   1      
 149   1        /*P1M1 |= 0x2C;
 150   1        P1M2 &= 0xDF;
 151   1        P1M2 |= 0x0C;*/
 152   1         P1M1 &= 0xEC;
 153   1        P1M1 |= 0x2C;
 154   1        P1M2 &= 0xDF;
 155   1        P1M2 |= 0x1F;
 156   1      
 157   1      
 158   1      } // ports_init
 159          //*******************add**********************************************
 160          
 161          
 162           /****************************************************************************
 163          *                                                                           *
 164          * Function:     START_T0                                                    *
 165          *                                                                           *
 166          * Input:        -                                                           *
 167          * Output:       -                                                           *
 168          *                                                                           *
 169          * Description:                                                              *
 170          *                                                                           *
 171          *                                                                           *
C51 COMPILER V7.05   MAIN                                                                  03/05/2003 15:44:08 PAGE 4   

 172          ****************************************************************************/
 173          void START_T0(unsigned char x)
 174          {
 175   1        ET0 = 0 ;
 176   1        TR0 = 0;
 177   1        RXTimerOUT = x ;
 178   1        TL0 = 0;
 179   1        TH0 = 0;
 180   1        TR0 = 1;
 181   1        ET0 = 1 ;
 182   1      }                
 183          /****************************************************************************
 184          *                                                                           *
 185          * Function:     CALL_isr_T0                                                 *
 186          *                                                                           *
 187          * Input:        -                                                           *
 188          * Output:       -                                                           *
 189          *                                                                           *
 190          * Description:                                                              *
 191          *                                                                           *
 192          *                                                                           *
 193          ****************************************************************************/
 194          void CALL_isr_T0(void)
 195          {
 196   1        TR0 = 0;
 197   1        RXTimerOUT = 0; 
 198   1        TF0 = 1;
 199   1      
 200   1      }
 201          
 202          //********************串口中断处理程序**************************************************************
 203          void ub1ISR(void) interrupt 4 using 1
 204          {
 205   1         unsigned char c;
 206   1        // unsigned int data crcx;
 207   1         if ( RI )                                        // Receive Command
 208   1        {
 209   2         // RXTimerOUT=10;
 210   2          RI = 0;
 211   2              c  = SBUF;
 212   2      
 213   2              switch(RXSTAT)
 214   2              {
 215   3                case 0:                          //接受帧头02
 216   3                       if(c==0x55)
 217   3                     {RXSTAT=1;START_T0(20);RXtem[0]=c;}
 218   3                               else
 219   3                     CALL_isr_T0();
 220   3                       break;
 221   3                case 1:                       //接收
 222   3                   if(c==0xaa)
 223   3                                 {  
 224   4                        RXSTAT=2;
 225   4                        START_T0(20);
 226   4                                        RXtem[1]=c;
 227   4                     }
 228   3                   else
 229   3                                { 
 230   4                                  if(c==0xbb)

⌨️ 快捷键说明

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