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

📄 util.lst

📁 这是用W77E58编写的控制GSM模块
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.50   UTIL                                                                  04/04/2007 15:49:16 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE UTIL
OBJECT MODULE PLACED IN util.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE util.c BROWSE DEBUG OBJECTEXTEND CODE

line level    source

   1          /* YuanGao electronic designe co.ldt
   2             (c) Copyright 2002,2003, All Rights Reserved  */
   3          
   4          #include <w77e58.h>
   5          #include "global.h"
   6          #include "io.h"
   7          #include "util.h"
   8          
   9          
  10          //#define UART0_9600_11M
  11          #define UART0_19200_11M
  12          
  13          //#define UART0_38400_11M
  14          
  15          
  16          //uchar   idata   SysTask;
  17          uchar   idata   SysTimer;
  18          uchar   idata   Uart0Timer;
  19          UINT16     idata   GPSTimer30;
  20          
  21          uchar   idata _timer0=0;            /* timer0 interrupt counter, use this counter to adjust timeout counte
             -rs period */
  22          #define TIMEOUT_FACTOR      17                /* timeout factor x 1.0ms (timer0 period) = actual timeout p
             -eriod     */
  23          
  24          
  25          
  26          //P3.2 0003H INT0
  27          void ISR_INT0(void) interrupt 0 //using 1
  28          {
  29   1         ;     
  30   1      }
  31          
  32          
  33          
  34          //Timer0 000BH
  35          void ISR_Timer0(void) interrupt 1 //using 2
  36          {
  37   1      
  38   1            //TIMER0: Mode 1每中断一次的时间间隔是:Timer=T x (2^16-TH0TL0),T=(12/11.0592)/4; 0XF760的定时是:0.27
             -126736 X (65536-63328)=0.27126736X2208=599u
  39   1            //TIMEOUT_FACTOR=17的定时为:17x599us =10183 us =10(ms)
  40   1                       
  41   1      
  42   1              TF0 = 0;
  43   1              TH0 = 0xF7;                          
  44   1              TL0 = 0x60;                 
  45   1              TR0 = 1;               
  46   1          
  47   1              /* count down timeout counters  */
  48   1              if( _timer0 < TIMEOUT_FACTOR )
  49   1                      _timer0++;
  50   1              else
  51   1              {
  52   2                      _timer0 = 0;
C51 COMPILER V7.50   UTIL                                                                  04/04/2007 15:49:16 PAGE 2   

  53   2                      if(SysTimer)   SysTimer--;
  54   2                      if(Uart0Timer) Uart0Timer--;
  55   2                      if(GPSTimer30) GPSTimer30--;             
  56   2      
  57   2      
  58   2              }
  59   1      
  60   1      }
  61          
  62          
  63          //P3.3 Int1 0013H
  64          void ISR_INT1(void) interrupt 2 //using 1
  65          {
  66   1             
  67   1      ;
  68   1      
  69   1      }
  70          
  71          
  72          
  73          
  74          
  75          
  76          
  77          /**************************************************************************
  78          *  Timer1 for 1.5ms interrupt                                               
  79          **************************************************************************/
  80          //Timer1 001bH
  81          void ISR_Timer1(void) interrupt 3 //using 1
  82          {
  83   1      #if 0
              
                      
                      TH1 = 0xf7;                 /*  0xf7 */
                      TL1 = 0;                    /*  0x0  */
                      TR1 = 1;               
              
              
                      /* count down timeout counters  */
                      if( _timer0 < TIMEOUT_FACTOR )
                              _timer0++;
                      else
                      {
                              _timer0 = 0;
                              if(SysTimer) SysTimer--;
                      }
              #endif
 100   1      
 101   1      
 102   1      }
 103          
 104          
 105          
 106          #if 0
              //*****************************************
              //串口中断处理
              //serial_0  0023H
              void serial(void) interrupt 4   //using 2
              {   
                  if (TI)
                  {        
                          TI = 0;
C51 COMPILER V7.50   UTIL                                                                  04/04/2007 15:49:16 PAGE 3   

                         //SBUF='1';
                               #if 1
                          if (outbufsign)
                          //if (putlast==outlast) outbufsign=0;
                          //else
                          {
                                          SBUF=*outlast; //未发送完继续发送
                              outlast++;            //最后传出去的字节位置加一
                              if (outlast==outbuf+OLEN) outlast=outbuf;//地址到顶部回到底部
                              if (putlast==outlast) outbufsign=0;   //数据发送完置发送缓冲区空标志
                           }
                           else outbufsign0=0;
                       #endif
                      
                       
                          
              
                  }
                  
                      if (RI)
                  {  
                           #if 0
                          RI = 0;
                          if(!inbufful)
                          {
                            *inlast= SBUF;              //放入数据
                            inlast++;                   //最后放入的位置加一
                            inbufsign=1;
                            if (inlast==inbuf+ILEN)     inlast=inbuf; //地址到顶部回到底部
                            if (inlast==getlast)        inbufful=1;   //接收缓冲区满置满标志
              
                          }
                       #endif 
                 }
              }
              
              #endif
 152          
 153          
 154          /**************************************************************************
 155          *  Timer2 for 2ms interrupt                                               
 156          **************************************************************************/
 157          //002BH
 158          void ISR_Timer2(void) interrupt 5 //using 1
 159          {
 160   1      
 161   1      ;
 162   1      
 163   1      }
 164          
 165          
 166          #if 0
              
              //SERIAL 1 003BH
              void serial_1(void) interrupt 7  //using 2
              {    
                  
                  if(RI_1)
                  {
                      RI_1 = 0;
                  }
                  if(TI_1)
C51 COMPILER V7.50   UTIL                                                                  04/04/2007 15:49:16 PAGE 4   

                  {
                     TI_1=0;
                     SBUF1=0x34;
                   
                       #if 0  
                     while(TI_1_1==0) ;
                     TI_1=0;
                     SBUF1=0x35;
                     while(TI_1_1==0) ;
                     TI_1=0;
                     SBUF1=0x36;
                     while(TI_1_1==0) ;
                     TI_1=0;
                   #endif    
                  
                      }
              } 
              
              #endif
 196          
 197          
 198          //P1.4
 199          void ISR_Int2(void) interrupt 8 //using 1
 200          {
 201   1      
 202   1            //if(SysTask==0)SysTask++;  
 203   1      
 204   1      
 205   1      }
 206          
 207          
 208          void ISR_Int3(void) interrupt 9 //using 1
 209          {
 210   1      
 211   1      ;
 212   1      
 213   1      }
 214          
 215          
 216          void ISR_Int4(void) interrupt 10 //using 1
 217          {
 218   1      
 219   1      ;
 220   1      
 221   1      }
 222          
 223          void ISR_Int5(void) interrupt 11 //using 1
 224          {
 225   1      
 226   1      ;
 227   1      
 228   1      }
 229          
 230          
 231          void ISR_WatchDog(void) interrupt 12 //using 1
 232          {
 233   1      
 234   1      ;
 235   1      
 236   1      }
 237          
 238          
C51 COMPILER V7.50   UTIL                                                                  04/04/2007 15:49:16 PAGE 5   

 239          #ifdef DEBUG_GPS
 240          #define UART1_9600_11M
 241          #else
              #define UART1_4800_11M
              #endif
 244          /**************************************************************************
 245          *  Init system                                                            
 246          **************************************************************************/
 247          void CPU_init(void)
 248          {
 249   1      
 250   1                 EA  = 0;
 251   1                 EIE = 0;
 252   1                 
 253   1                 P1=0xff;
 254   1                 P3=0xff;
 255   1                 P0=0xff;
 256   1                   
 257   1                //system init ,其中串口0用定时器2,串口1用定时器1 
 258   1                //串口1的设置
 259   1                IE = 0x90;         //允许总中断和串口0的中断
 260   1                TMOD=0x20;       //定时器1工作在模式2
 261   1                //CKCON=0x30;      //Timerl和Timer2时钟为1/12CLOCK
 262   1                    //CKCON |= 0x10;     //Timer1 =1/4 clock   
 263   1                //CKCON |= 0x20;     //Timer2 =1/4 clock   
 264   1             

⌨️ 快捷键说明

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