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

📄 pb_dp.h

📁 profibus dp主站于从站通信
💻 H
📖 第 1 页 / 共 4 页
字号:
/*****************************************************************************/
/*                                                                           */
/*                                SOFTING AG                                 */
/*                        Richard-Reitzner-Allee 6                           */
/*                              D-85540 Haar                                 */
/*                      Phone: (++49)-(0)89-45656-0                          */
/*                      Fax:   (++49)-(0)89-45656-399                        */
/*                                                                           */
/*                    Copyright (C) SOFTING AG 1995-2007                     */
/*                            All Rights Reserved                            */
/*                                                                           */
/*****************************************************************************/
/*****************************************************************************/
/*                        DP GLOBAL DEFINES and TYPES                        */
/*                                                                           */
/*  Filename    : PB_DP.H                                                    */
/*  Version     : 5.22.0.00.release                                          */
/*  Date        : 26-February-1999                                           */
/*  Author      : SOFTING AG                                                 */
/*                                                                           */
/*  Description : This file contains the global defines and types of         */
/*                component DP                                               */
/*                                                                           */
/*****************************************************************************/

#ifndef __PB_DP__
#define __PB_DP__


#pragma warning (disable : 4103)     /* used #pragma pack to change alignment */
#ifdef WIN32
#pragma pack(push,1)
#else
#pragma pack(1)
#endif
#pragma warning (default : 4103)



/****************************************************************************/
/*** DEFINES ****************************************************************/
/****************************************************************************/

/*--- COMMON DP CONSTANTS --------------------------------------------------*/

#define DP_MAX_NUMBER_STATIONS      127
#define DP_MAX_NUMBER_SLAVES        125

#define DP_GLOBAL_STATION_ADDRESS   127
#define DP_DEFAULT_SLAVE_ADDRESS    126
#define DP_NO_MASTER_ADDRESS        255
#define DP_MAX_SLAVE_ADDRESS        20

#define DP_MAX_TELEGRAM_LEN         244                /* 246 not supported */
#define DP_STATUS_INFO_LEN          128

#define DP_MASTER_USER_DATA_LEN     34
#define DP_MASTER_CLASS2_NAME_LEN   32

#define DP_MIN_SLAVE_DIAG_LEN       6     /* min/max length of service data */
#define DP_MIN_PRM_DATA_LEN         9
#define DP_MIN_CFG_DATA_LEN         3
#define DP_MIN_SLAVE_PARA_LEN       32
#define DP_MIN_BUS_PARA_LEN         66

#define DP_MAX_SLAVE_DIAG_DATA_LEN  244   /* SLAVE- != MASTER- MAX_DIAG_LEN */
#define DP_MAX_MASTER_DIAG_DATA_LEN 242
#define DP_MAX_EXT_DIAG_DATA_LEN    238
#define DP_MAX_OUTPUT_DATA_LEN      244
#define DP_MAX_INPUT_DATA_LEN       244
#define DP_MAX_PRM_DATA_LEN         244
#define DP_MAX_CFG_DATA_LEN         244
#define DP_MAX_AAT_DATA_LEN         492
#define DP_MAX_USER_PRM_DATA_LEN    234
#define DP_MAX_DOWNLOAD_DATA_LEN    240
#define DP_MAX_UPLOAD_DATA_LEN      240
#define DP_MAX_REM_SLAVE_DATA_LEN   238
#define DP_MAX_SLAVE_USER_DATA_LEN  65470
#define DP_MAX_MASTER_USER_DATA_LEN 65470
#define DP_MAX_SET_BUSPARAMETER_LEN 196
#define DP_MAX_MSAC2_DATA_LEN       220

/****************************************************************************/
/* DP USER SERVICE CODES                                                    */
/****************************************************************************/

/*--- DP USER SERVICE IDENTIFIERS ------------------------------------------*/

#define DP_SERVICE_USIF             0x80
#define DP_SERVICE_DDLM             0x00

#define DP_SERVICE_SERV             (DP_SERVICE_USIF | 0x60)
#define DP_SERVICE_SCHED            (DP_SERVICE_USIF | 0x40)
#define DP_SERVICE_SLAVE            (DP_SERVICE_USIF | 0x20)

#define DP_SERVICE_MM               (DP_SERVICE_DDLM | 0x60)
#define DP_SERVICE_MSAC2            (DP_SERVICE_DDLM | 0x40)

/*--- DP SERVICE HANDLER SERVICES ------------------------------------------*/

#define DP_DOWNLOAD_LOC             (DP_SERVICE_SERV | 0x01)
#define DP_UPLOAD_LOC               (DP_SERVICE_SERV | 0x02)
#define DP_START_SEQ_LOC            (DP_SERVICE_SERV | 0x03)
#define DP_END_SEQ_LOC              (DP_SERVICE_SERV | 0x04)
#define DP_GET_SLAVE_DIAG           (DP_SERVICE_SERV | 0x05)
#define DP_SET_PRM_LOC              (DP_SERVICE_SERV | 0x06)
#define DP_GET_MASTER_DIAG_LOC      (DP_SERVICE_SERV | 0x07)
#define DP_GET_SLAVE_PARAM          (DP_SERVICE_SERV | 0x08)
#define DP_SET_BUSPARAMETER         (DP_SERVICE_SERV | 0x09)
#define DP_SET_MASTER_PARAM         (DP_SERVICE_SERV | 0x0A)

/*--- DP SCHEDULER SERVICES ------------------------------------------------*/

#define DP_INIT_MASTER              (DP_SERVICE_SCHED | 0x01)
#define DP_ACT_PARAM_LOC            (DP_SERVICE_SCHED | 0x02)
#define DP_DATA_TRANSFER            (DP_SERVICE_SCHED | 0x03)
#define DP_EXIT_MASTER              (DP_SERVICE_SCHED | 0x04)
#define DP_CONFIGURATION            (DP_SERVICE_SCHED | 0x05)
#define DP_TERMINATION              (DP_SERVICE_SCHED | 0x06)

/*--- DP DDLM SERVICES -----------------------------------------------------*/

#define DP_SET_PRM                  (DP_SERVICE_DDLM | 0x00)    /* SRD: M/S */
#define DP_CHK_CFG                  (DP_SERVICE_DDLM | 0x01)
#define DP_GET_CFG                  (DP_SERVICE_DDLM | 0x02)
#define DP_SLAVE_DIAG               (DP_SERVICE_DDLM | 0x03)
#define DP_RD_INP                   (DP_SERVICE_DDLM | 0x04)
#define DP_RD_OUTP                  (DP_SERVICE_DDLM | 0x05)
#define DP_DATA_EXCHANGE            (DP_SERVICE_DDLM | 0x06)
#define DP_SET_SLAVE_ADD            (DP_SERVICE_DDLM | 0x07)

#define DP_DOWNLOAD                 (DP_SERVICE_MM   | 0x08)    /* SRD: M/M */
#define DP_UPLOAD                   (DP_SERVICE_MM   | 0x09)
#define DP_START_SEQ                (DP_SERVICE_MM   | 0x0A)
#define DP_END_SEQ                  (DP_SERVICE_MM   | 0x0B)
#define DP_ACT_PARAM                (DP_SERVICE_MM   | 0x0C)
#define DP_GET_MASTER_DIAG          (DP_SERVICE_MM   | 0x0D)

#define DP_GLOBAL_CONTROL           (DP_SERVICE_DDLM | 0x0E)    /* SDN: M/S */
#define DP_ACT_PARA_BRCT            (DP_SERVICE_MM   | 0x0F)    /* SDN: M/M */

#define DP_FAULT                    (DP_SERVICE_DDLM | 0x10)       /* local */

/*--- DP DDLM SERVICE FOR DP/V1 --------------------------------------------*/

#define DP_INITIATE                 (DP_SERVICE_MSAC2 | 0x00)
#define DP_ABORT                    (DP_SERVICE_MSAC2 | 0x01)
#define DP_READ                     (DP_SERVICE_MSAC2 | 0x02)
#define DP_WRITE                    (DP_SERVICE_MSAC2 | 0x03)
#define DP_DATA_TRANSPORT           (DP_SERVICE_MSAC2 | 0x04)

/****************************************************************************/
/* DP SERVICE CONSTANTS                                                     */
/****************************************************************************/

/*--- MASTER AUTOMATIC REMOTE SERVICES -------------------------------------*/

#define DP_AUTO_GET_MASTER_DIAG     0x80
#define DP_AUTO_UPLOAD_DOWNLOAD_SEQ 0x40
#define DP_AUTO_ACT_PARAM           0x20

#define DP_AUTO_REMOTE_SERVICES     ( DP_AUTO_GET_MASTER_DIAG     |          \
                                      DP_AUTO_UPLOAD_DOWNLOAD_SEQ |          \
                                      DP_AUTO_ACT_PARAM )

#define DP_USER_REMOTE_SERVICES     0x00

/*--- SLAVE DPRAM ADDRESS ASSIGNMENT MODES ---------------------------------*/

#define DP_AAM_ARRAY                0x00
#define DP_AAM_DEFINED              0x01
#define DP_AAM_COMPACT              0x02
#define DP_AAM_IO_BLOCKS            0x03

/*--- DP SLAVE FLAGS -------------------------------------------------------*/

#define DP_SL_ACTIVE                0x80
#define DP_SL_NEW_PRM               0x40
#define DP_SL_FAIL_SAFE             0x20

#define DP_SL_FLAGS                 ( DP_SL_ACTIVE    |                      \
                                      DP_SL_NEW_PRM   |                      \
                                      DP_SL_FAIL_SAFE )

/*--- DP BUS PARAMETER FLAGS -----------------------------------------------*/

#define DP_BP_ERROR_ACTION          0x80

#define DP_BP_FLAGS                 (DP_BP_ERROR_ACTION)

/*--- DP SLAVE TYPES -------------------------------------------------------*/

#define DP_SLAVE_TYPE_DP            0x00           /* default DP Slave type */

/*--- DP SLAVE PARAMETERIZATION STATION STATUS -----------------------------*/

#define DP_PRM_LOCK_REQ             0x80
#define DP_PRM_UNLOCK_REQ           0x40
#define DP_PRM_SYNC_REQ             0x20
#define DP_PRM_FREEZE_REQ           0x10
#define DP_PRM_WD_ON                0x08

#define DP_PRM_STATION_STATUS       ( DP_PRM_LOCK_REQ   |                    \
                                      DP_PRM_UNLOCK_REQ |                    \
                                      DP_PRM_SYNC_REQ   |                    \
                                      DP_PRM_FREEZE_REQ |                    \
                                      DP_PRM_WD_ON )

/*--- DP SLAVE GLOBAL CONTROL BITS -----------------------------------------*/

#define DP_CONTROL_SYNC             0x20
#define DP_CONTROL_UNSYNC           0x10
#define DP_CONTROL_FREEZE           0x08
#define DP_CONTROL_UNFREEZE         0x04
#define DP_CONTROL_CLEAR_DATA       0x02

#define DP_CONTROL_COMMAND          ( DP_CONTROL_SYNC       |               \
                                      DP_CONTROL_UNSYNC     |               \
                                      DP_CONTROL_FREEZE     |               \
                                      DP_CONTROL_UNFREEZE   |               \
                                      DP_CONTROL_CLEAR_DATA )

/*--- DP AREA CODES --------------------------------------------------------*/

#define DP_AREA_SLAVE_PARAM         0x00
#define DP_AREA_BUS_PARAM           0x7F
#define DP_AREA_SET_MODE            0x80
#define DP_AREA_STAT_COUNT          0x81
#define DP_AREA_NO_PROTECTION       0xFF

/*--- DP AREA / ACTIVATION CODES -------------------------------------------*/

#define DP_SLAVE_ACTIVATE           0x80  /* values are area code dependent */
#define DP_SLAVE_DEACTIVATE         0x00

#define DP_BUS_PAR_ACTIVATE         0xFF

#define DP_OP_MODE_OFFLINE          0x00
#define DP_OP_MODE_STOP             0x40
#define DP_OP_MODE_CLEAR            0x80
#define DP_OP_MODE_RED_CLEAR        0x81            /* new redundancy state */
#define DP_OP_MODE_OPERATE          0xC0
#define DP_OP_MODE_RED_OPERATE      0xC1            /* new redundancy state */

/*--- DP MASTER DIAG IDENTIFIERS -------------------------------------------*/

#define DP_DIAG_SLAVE_DATA          0x00
#define DP_DIAG_SYSTEM_DIAGNOSTIC   0x7E
#define DP_DIAG_MASTER_STATUS       0x7F
#define DP_DIAG_DATA_TRANSFER_LIST  0x80

/*--- DP SLAVE PARAM IDENTIFIERS -------------------------------------------*/

#define DP_SLAVE_PARAM_HEADER       0x01
#define DP_SLAVE_PARAM_PRM_DATA     0x02
#define DP_SLAVE_PARAM_CFG_DATA     0x03
#define DP_SLAVE_PARAM_AAT_DATA     0x04
#define DP_SLAVE_PARAM_USER_DATA    0x05
#define DP_SLAVE_PARAM_SLAVE_INFO   0x06
#define DP_SLAVE_PARAM_SYS_INFO     0x07
#define DP_SLAVE_PARAM_FLUSH_DIAG   0x08

/*--- DP SET MASTER PARAM IDENTIFIERS --------------------------------------*/

#define DP_SET_IDENT_NUMBER         0x00

/*--- DP SLAVE DIAG BITS ---------------------------------------------------*/

#define DP_DIAG_1_MASTER_LOCK           0x80     /* influenced by DP Master */
#define DP_DIAG_1_PRM_FAULT             0x40
#define DP_DIAG_1_INVALID_SLAVE_RES     0x20     /* influenced by DP Master */
#define DP_DIAG_1_NOT_SUPPORTED         0x10
#define DP_DIAG_1_EXT_DIAG              0x08
#define DP_DIAG_1_CFG_FAULT             0x04
#define DP_DIAG_1_STATION_NOT_READY     0x02
#define DP_DIAG_1_STATION_NON_EXISTENT  0x01     /* influenced by DP Master */

#define DP_DIAG_1_STATUS                0xFF

#define DP_DIAG_2_DEACTIVATED           0x80     /* influenced by DP Master */
#define DP_DIAG_2_SYNC_MODE             0x20
#define DP_DIAG_2_FREEZE_MODE           0x10
#define DP_DIAG_2_WD_ON                 0x08
#define DP_DIAG_2_DEFAULT               0x04
#define DP_DIAG_2_STAT_DIAG             0x02
#define DP_DIAG_2_PRM_REQ               0x01

#define DP_DIAG_2_STATUS                ( DP_DIAG_2_DEACTIVATED |            \
                                          DP_DIAG_2_SYNC_MODE   |            \
                                          DP_DIAG_2_FREEZE_MODE |            \
                                          DP_DIAG_2_WD_ON       |            \
                                          DP_DIAG_2_PRM_REQ )

#define DP_DIAG_3_EXT_DIAG_OVERFLOW     0x80

#define DP_DIAG_3_STATUS                ( DP_DIAG_3_EXT_DIAG_OVERFLOW )

#define DP_SLAVE_DIAG_OVERFLOW          (-1)
#define DP_STATION_NON_EXISTENT         0x0100
#define DP_INVALID_SLAVE_RESPONSE       0x2000

/*--- DP STATION STATUS ----------------------------------------------------*/

⌨️ 快捷键说明

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