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

📄 intspc3.lst

📁 使用8052单片机控制SPC3总线桥实现PROFIBUS-DP现场总线的从站部分C程序源码
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.50   INTSPC3                                                               10/24/2007 09:35:19 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE INTSPC3
OBJECT MODULE PLACED IN INTSPC3.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE INTSPC3.C LARGE OPTIMIZE(SIZE) BROWSE DEBUG OBJECTEXTEND

line level    source

   1          /*
   2          +------------------------------------------------------------------------+
   3          | Project: D P S 2   w i t h   S P C 3                                   |
   4          |                                                                        |
   5          | File:   DPS2SPC3.C                                                     |
   6          | Date:   27-Sep-2007                                                    |
   7          | Version: V 1.17                                                        |
   8          | Initial Editor:   Thomas Lang   Final Editor:  Wujiang Zhang           |
   9          +------------------------------------------------------------------------+
  10          | Description:                                                           |
  11          |  This module handles the interupts of the SPC3                         |
  12          +------------------------------------------------------------------------+
  13          | following environments are supported                                   |
  14          |  Processor: SAB C165                                                   |
  15          |   Compiler: BSO Tasking 80166 C Cross-Compiler, V 4.0                  |
  16          |  Processor: iNTEL 8032                                                 |
  17          |   Compiler: Keil                                                       |
  18          |                                                                        |
  19          |                                                                        |
  20          +------------------------------------------------------------------------+
  21          |                    Copyright (C) SIEMENS AG, 1994                      |
  22          |                         All Rights reserved                            |
  23          +------------------------------------------------------------------------+
  24          | History:                                                                                                                               |
  25          | V0.9,SX,24-Oct-1995, Pilot verion                                      |
  26          | V1.0,SX,02-Nov-1995, 1st version                                       |
  27          | V1.1,SX,14-Nov-1995, Addition of the attribute SPC3_PTR_ATTR           |
  28          |                       (= xdata) at *user_io_data_len_ptr               |
  29          | V1.3,MM,24-Mar-1997, & --> && in parameter-check-routine               |
  30          |                                                                        |
  31          +------------------------------------------------------------------------+
  32          | Technical support:       Siemens Schnittstellencenter                  |
  33          |                          AUT7 WKF B1 TDL2                              |
  34          |                                                                        |
  35          |   Schmidt Xaver                   Mittelberger Martin                  |
  36          |   Tel.: 0911/750-2079             Tel.: 0911/750-2072                  |
  37          |                                                                        |
  38          |                   Fax.:         -2100                                  |
  39          |                   Mailbox: 0911/737972                                 |
  40          |                                                                        |
  41          +------------------------------------------------------------------------+
  42          */
  43          
  44          #define SPC3_INTEL_MODE         TRUE
  45          #define SPC3_FAR
  46          
  47          #define SPC3_DPS2
  48          #define SPC3_DATA_XDATA
  49          
  50          
  51          #include "spc3dps2.h"
  52          
  53          #if defined __C51__
  54                                                          /* special defines for the 80166 processor */
  55                                                          /* are set to nothing */
C51 COMPILER V7.50   INTSPC3                                                               10/24/2007 09:35:19 PAGE 2   

  56                  #define huge
  57                  #define global
  58                  #define public
  59          #elif   _C166
                      #include "reg.h"
              #else
                      #include <dos.h>
              #endif
  64          
  65          
  66          /*----------------------------------------------------------------------*/
  67          /*                       STRUCTURES AND TYPEDEFS                        */
  68          /*----------------------------------------------------------------------*/
  69          
  70          /*----------------------------------------------------------------------*/
  71          /*                       EXTERNAL FUNCTIONS                             */
  72          /*----------------------------------------------------------------------*/
  73          
  74          /*----------------------------------------------------------------------*/
  75          /*                       INTERNAL FUNCTIONS                             */
  76          /*----------------------------------------------------------------------*/
  77          void address_data_function (void SPC3_PTR_ATTR*, UBYTE);
  78          void wd_dp_mode_timeout_function (void);
  79          void global_ctrl_command_function (void);
  80          void go_leave_data_ex_function (void);
  81          
  82          /*----------------------------------------------------------------------*/
  83          /*                       LITERALLIES                                    */
  84          /*----------------------------------------------------------------------*/
  85          
  86          
  87          
  88          #define DPS_CFG_OK      0
  89          #define DPS_CFG_FAULT   1 
  90          #define DPS_CFG_UPDATE  2
  91          
  92          /*----------------------------------------------------------------------*/
  93          /*                       MACROS                                         */
  94          /*----------------------------------------------------------------------*/
  95          
  96          /*----------------------------------------------------------------------*/
  97          /*                       GLOBAL VARIABLES                               */
  98          /*----------------------------------------------------------------------*/
  99          
 100          UBYTE                   user_dps_state;
 101          UBYTE                   user_global_ctrl_command;
 102          UBYTE                   user_wd_state;
 103          UBYTE                   store_mintsdr;  
 104          
 105          extern UBYTE            real_no_add_chg;
 106          extern UBYTE            this_station;
 107          extern UBYTE            cfg_akt [20];
 108          extern UBYTE            cfg_len_akt;
 109          extern DPS2_IO_DATA_LEN SPC3_PTR_ATTR *user_io_data_len_ptr;  /* Aenderung 14.11.95 */
 110          extern UBYTE            prm_tst_buf[];
 111          #ifndef _IM182
 112          extern SPC3 SPC3_PTR_ATTR spc3;
 113          #endif
 114          
 115          /************************************************************************/
 116          /*  D e s c r i p t i o n :                                             */
 117          /*                                                                      */
C51 COMPILER V7.50   INTSPC3                                                               10/24/2007 09:35:19 PAGE 3   

 118          /*  dps2_ind                                                            */
 119          /*                                                                      */
 120          /*  This function is called by the hardware interrupt                   */
 121          /************************************************************************/
 122          
 123          #if defined __C51__
 124                  void dps2_ind(void)    interrupt 0
 125          #elif   _C166
                      interrupt (0x1b) void dps2_ind(void)    /* CC11 = EX3IN */
              #else
                      void dps2_ind(void)
              #endif
 130          
 131          {
 132   1      
 133   1      
 134   1      if(DPS2_GET_IND_GO_LEAVE_DATA_EX())
 135   1              {   /*=== Start or the end of the Data-Exchange-State ===*/
 136   2              go_leave_data_ex_function();
 137   2              DPS2_CON_IND_GO_LEAVE_DATA_EX();    /* confirm this indication */
 138   2              }
 139   1      
 140   1      if(DPS2_GET_IND_NEW_GC_COMMAND())
 141   1              {   /*===  New Global Control Command ===*/
 142   2              global_ctrl_command_function();
 143   2              DPS2_CON_IND_NEW_GC_COMMAND();  /* confirm this indication */
 144   2              }
 145   1      
 146   1      if(DPS2_GET_IND_NEW_PRM_DATA())
 147   1              {   /*=== New parameter  data ===*/
 148   2              UBYTE   SPC3_PTR_ATTR * prm_ptr;
 149   2              UBYTE   param_data_len, prm_result;
 150   2              UBYTE   ii;
 151   2      
 152   2              prm_result = DPS2_PRM_FINISHED;
 153   2              do
 154   2                      { /* Check parameter until no conflict behavior */
 155   3                      prm_ptr = DPS2_GET_PRM_BUF_PTR();
 156   3                      param_data_len = DPS2_GET_PRM_LEN();
 157   3      
 158   3                      /* data_length_netto of parametration_telegram > 7 */
 159   3                      if (param_data_len > 7)
 160   3                              {
 161   4                              if (( *(prm_ptr+8) == 0xAA)  && ( *(prm_ptr+9) == 0xAA))
 162   4                                      prm_result = DPS2_SET_PRM_DATA_NOT_OK(); /* as example !!! */
 163   4                              else
 164   4                                      {
 165   5                                      for (ii= 0; ii<param_data_len && ii <10; ii++)  /* store in the interim buffer */
 166   5                                              prm_tst_buf[ii] = *(prm_ptr+ii+7);          /* for the diagnostic */
 167   5                                                                                                                              /* !!!!!! as example !!!! */
 168   5      
 169   5                                      prm_result = DPS2_SET_PRM_DATA_OK();
 170   5                                      }
 171   4                              }
 172   3                      else
 173   3                              prm_result = DPS2_SET_PRM_DATA_OK();
 174   3      
 175   3                      } while(prm_result == DPS2_PRM_CONFLICT);
 176   2      
 177   2              store_mintsdr =  *(prm_ptr+3);    /* store the mintsdr for restart after */
 178   2                                                                                /* baudrate search */
 179   2      
C51 COMPILER V7.50   INTSPC3                                                               10/24/2007 09:35:19 PAGE 4   

 180   2              }
 181   1      
 182   1      if(DPS2_GET_IND_NEW_CFG_DATA())
 183   1              {   /*=== New Configuration data ===*/
 184   2              UBYTE SPC3_PTR_ATTR * cfg_ptr;
 185   2              UBYTE config_data_len, cfg_result, result;
 186   2      
 187   2              cfg_result = DPS2_CFG_FINISHED;

⌨️ 快捷键说明

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