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

📄 gsmmodem.lst

📁 SPWM三相波形发生器
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.08   GSMMODEM                                                              12/25/2004 18:50:53 PAGE 1   


C51 COMPILER V7.08, COMPILATION OF MODULE GSMMODEM
OBJECT MODULE PLACED IN GsmModem.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE GsmModem.c OPTIMIZE(SIZE) REGFILE(.\gprsnew.ORC) BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include <reg52.h>
   2          #include <string.h>
   3          
   4          #define         uchar    unsigned char 
   5          #define         uint     unsigned int
   6          
   7          sfr WMCON   = 0x96;     /* Watchdog and Memory Control Register */
   8          #define WDTC() (WMCON |= 0x02)
   9          
  10          extern          void put_chars(uchar *p);
  11          extern          void _AsyncPut(uchar ucValue);
  12          
  13          //---------main.c-------------------------
  14          sbit LED = P3^7;
  15          
  16          extern  unsigned char idata input[32];
  17          extern  unsigned long data      TempCount       ;
  18          extern  unsigned long GET_COUNT();
  19          extern  void  Delay(uint x)             ;               /*      x*10 ms                                 */
  20          
  21          //----------eeprom.c----------------------
  22          extern  void    ReadUserBlock(uchar idata *input,uint Address,uchar Number);
  23          
  24          //-----------comm.c-----------------------
  25          extern  void    put_chars(uchar *p);
  26          extern  uchar   _AsyncGet(void);
  27          extern  bit         _AsyncGetTest(void);
  28          extern  void  Vol_control(void);
  29          extern  uchar   data    Vol_Rec;
  30          
  31          sbit MRST = P3^5;       //reset  mc35   at least 100 ms.        can't use P1_4.
  32          
  33          /*******************************
  34          **      output string through expcom
  35          ********************************/
  36          void ModemSend(uchar *String)
  37          {
  38   1              put_chars(String);
  39   1      }
  40          
  41          void  ModemRead(uchar *String,uchar Len)        /*      timeout * 10 ms  */
  42          {
  43   1              uchar    MatchPosition ;
  44   1              uchar tempdata;
  45   1              MatchPosition = 0;
  46   1      
  47   1              TempCount = GET_COUNT();
  48   1              while( 1)
  49   1              {       
  50   2                      if(Vol_Rec)
  51   2                      {
  52   3                              Vol_Rec = 0;
  53   3                              Vol_control();
  54   3                      }
  55   2                      if((GET_COUNT() - TempCount) > 500)
C51 COMPILER V7.08   GSMMODEM                                                              12/25/2004 18:50:53 PAGE 2   

  56   2                      {
  57   3                              String[MatchPosition]=0;
  58   3                              return;
  59   3                      }
  60   2                      if(_AsyncGetTest())     
  61   2                      {
  62   3                              tempdata = _AsyncGet();
  63   3                              if(tempdata > 0x20)
  64   3                              {
  65   4                                      String[MatchPosition]=tempdata;
  66   4                                      MatchPosition++;
  67   4                                      break;
  68   4                              }
  69   3                      }
  70   2                      WDTC();
  71   2                      PCON = PCON | 0x01;
  72   2              }
  73   1              while( 1)
  74   1              {
  75   2                      if(Vol_Rec)
  76   2                      {
  77   3                              Vol_Rec = 0;
  78   3                              Vol_control();
  79   3                      }
  80   2                      if((GET_COUNT() - TempCount) > 500)
  81   2                      {
  82   3                              String[MatchPosition]=0;
  83   3                              return;
  84   3                      }
  85   2                      if(_AsyncGetTest())     
  86   2                      {
  87   3                              tempdata = _AsyncGet();
  88   3                              if(tempdata > 0x20)
  89   3                              {
  90   4                                      String[MatchPosition]=tempdata;
  91   4                                      MatchPosition++;
  92   4                                      if(MatchPosition >= (Len-1))break;
  93   4                              }
  94   3                              else break;
  95   3                      }
  96   2                      WDTC();
  97   2                      PCON = PCON | 0x01;
  98   2              }
  99   1              String[MatchPosition]=0;
 100   1              return ;
 101   1      }
 102          /*******************************
 103          **      return 1: match success.
 104          **      return 0: match error.
 105          *******************************/
 106          unsigned char  ModemExpect(uchar *ExpectString,uint timeout)    /*      timeout * 10 ms  */
 107          {
 108   1              uchar    MatchPosition ;
 109   1              uchar    StringLenth;
 110   1              uchar tempdata;
 111   1              MatchPosition = 0;
 112   1              StringLenth = strlen(ExpectString);
 113   1              LED = 1;
 114   1              TempCount = GET_COUNT();
 115   1              while( MatchPosition < StringLenth) 
 116   1              {
 117   2                      if( GET_COUNT() - TempCount > timeout)
C51 COMPILER V7.08   GSMMODEM                                                              12/25/2004 18:50:53 PAGE 3   

 118   2                      {
 119   3                              return 0;
 120   3                      }
 121   2                      if(_AsyncGetTest())     
 122   2                      {
 123   3                              tempdata = _AsyncGet();
 124   3                              if(tempdata == ExpectString[MatchPosition])     MatchPosition++;
 125   3                              else MatchPosition = 0;                                 /*      match error,start again */
 126   3                      }
 127   2              }
 128   1              LED = 0;
 129   1              return 1;
 130   1      }
 131          
 132          
 133          /**********************************
 134          **      restet MC35 and CO110
 135          **      return 1: rest success,support 
 136                  at command.
 137          **      return 0: rest error,can't 
 138                  support at command.

⌨️ 快捷键说明

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