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

📄 intspc30816.lst

📁 pROFIBUS 从站源程序 SPC3 pROFIBUS 从站源程序 SPC3
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.02b   INTSPC30816                                                          11/01/2004 20:51:04 PAGE 1   


C51 COMPILER V7.02b, COMPILATION OF MODULE INTSPC30816
OBJECT MODULE PLACED IN INTSPC30816.OBJ
COMPILER INVOKED BY: D:\KEIL\C51\BIN\C51.EXE INTSPC30816.C LARGE ROM(COMPACT) BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          /*
   2          +--(︻┳一▄︻┻┳═一---------------------------------------------------+
   3          | Project: D P S 2   w i t h   S P C 3                                   |
   4          |                                                                        |
   5          | File:   INTSPC3.C                                                      |
   6          | Date:   24-Mar-1997                                                    |
   7          | Version: V 1.30                                                        |
   8          | Initial Editor:   Schmidt Xaver                                        |
   9          +------------------------------------------------------------------------+
  10          | Description:                                                           |
  11          |  This module handles the interupts of the SPC3(此模块处理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.02b   INTSPC30816                                                          11/01/2004 20:51:04 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.02b   INTSPC30816                                                          11/01/2004 20:51:04 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      if(DPS2_GET_IND_GO_LEAVE_DATA_EX())
 134   1              {   /*=== Start or the end of the Data-Exchange-State;数据交换状态的启停标志位;PDF69or75;PDF22;HP8==*/
 135   2              go_leave_data_ex_function();/* 得DP状态;即user_dps_state = DPS2_GET_DP_STATE(); .Hp10 */
 136   2              DPS2_CON_IND_GO_LEAVE_DATA_EX();    /* confirm this indication;PDF76 */
 137   2              }  
 138   1      
 139   1      if(DPS2_GET_IND_NEW_GC_COMMAND()) 
 140   1              {   /*===  New Global Control Command;新的全局控制命令;PDF69or75; .Hp8 ===*/
 141   2              global_ctrl_command_function();/*即user_global_ctrl_command = DPS2_GET_GC_COMMAND();.Ip9 ;.Hp10 */ 
 142   2              DPS2_CON_IND_NEW_GC_COMMAND();  /* confirm this indication;即spc3.int_reg.ack.b[_IMH] = (UBYTE)NEW_GC_COM
             -MAND_B;宏即0x01 */
 143   2              }
 144   1      
 145   1      if(DPS2_GET_IND_NEW_PRM_DATA())      /*  说明见PDF77 11.3.6;SHp39*/
 146   1              {   /*=== New parameter  data;新的参数数据;PDF75; .Hp8 ===*/
 147   2              UBYTE   SPC3_PTR_ATTR * prm_ptr;
 148   2              UBYTE   param_data_len, prm_result;
 149   2              UBYTE   ii;
 150   2      
 151   2              prm_result = DPS2_PRM_FINISHED; /* #define DPS2_PRM_FINISHED 0x00 */
 152   2              do
 153   2                      { /* Check parameter until no conflict behavior */
 154   3                      prm_ptr = DPS2_GET_PRM_BUF_PTR();/* .Hp;取参数区的buf指针 */
 155   3                      param_data_len = DPS2_GET_PRM_LEN();/*DPS2_GET_PRM_LEN()即spc3.r_len_prm_buf;.Hp9*/
 156   3      
 157   3                      /* data_length_netto of parametration_telegram > 7 */
 158   3                      if (param_data_len > 7)
 159   3                              {
 160   4                              if (( *(prm_ptr+8) == 0xAA)  && ( *(prm_ptr+9) == 0xAA))/* 检查参数正确吗?*/
 161   4                                prm_result = DPS2_SET_PRM_DATA_NOT_OK();/*$$as example!例子;PDF78;DPS2_SET_PRM_DATA_NOT_OK()即spc3.us
             -er_prm_data_nok;0FH*/
 162   4                              else
 163   4                                      {
 164   5                                      for (ii= 0; ii<param_data_len && ii <10; ii++)  /* store in the interim buffer */
 165   5                                              prm_tst_buf[ii] = *(prm_ptr+ii+7);          /* for the diagnostic;用于诊断 */
 166   5                                                                                                                              /* $$!!!! as example !!!! */
 167   5      
 168   5                                      prm_result = DPS2_SET_PRM_DATA_OK();/* DPS2_SET_PRM_DATA_OK()即spc3.user_prm_data_ok */
 169   5                                      }
 170   4                              }
 171   3                      else
 172   3                              prm_result = DPS2_SET_PRM_DATA_OK();/*见上行 */
 173   3      
 174   3                      } while(prm_result == DPS2_PRM_CONFLICT);/*#define DPS2_PRM_CONFLICT 0x01*/
 175   2      
 176   2              store_mintsdr =  *(prm_ptr+3);/* store the mintsdr for restart after;store_mintsdr全局变量 */
 177   2                                                                                /* baudrate search */
C51 COMPILER V7.02b   INTSPC30816                                                          11/01/2004 20:51:04 PAGE 4   

 178   2      
 179   2              }
 180   1      
 181   1      if(DPS2_GET_IND_NEW_CFG_DATA())  /* 新的组态数据;PDF75 */
 182   1              {   /*=== New Configuration data ===*/
 183   2              UBYTE SPC3_PTR_ATTR * cfg_ptr;
 184   2              UBYTE config_data_len, cfg_result, result;
 185   2      
 186   2              cfg_result = DPS2_CFG_FINISHED;
 187   2              result = DPS_CFG_OK;
 188   2      

⌨️ 快捷键说明

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