?? dp_cfg.h
字號:
/************************ Filename: dp_cfg.h ********************************/
/* ========================================================================= */
/* */
/* 0000 000 000 00000 0 000 0 0 0 0000 */
/* 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 */
/* 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Einsteinstra遝 6 */
/* 0000 000 0 0 000 0 0 00000 0 0000 91074 Herzogenaurach */
/* 0 00 0 0 0 0 0 0 0 0 0 */
/* 0 0 0 0 0 0 0 0 0 0 0 0 0 Tel: ++49-9132-744-200 */
/* 0 0 0 000 0 0 000 0 0 0 0 GmbH Fax: ++49-9132-744-204 */
/* */
/* ========================================================================= */
/* */
/* Function: Configuration file for VPC3+ */
/* */
/* ------------------------------------------------------------------------- */
/* */
/* Technical support: P. Fredehorst */
/* Tel. : ++49-9132/744-214 */
/* Fax. : -204 */
/* eMail: pfredehorst@profichip.com */
/* */
/*****************************************************************************/
/*****************************************************************************/
/* contents:
- compiler switches
- user defines
-
- length of buffers
- defines for MSAC2
- defines for MSAC1
- defines for ALARM
- defines for ISOCHRON
- defines for DXB PUBLISHER
- defines for DXB SUBSCRIBER
- Hardwaremode
- Interruptevents
- calculating area (do not edit this part)
*/
/*****************************************************************************/
/* reinclude protection */
#ifndef DP_CFG_H
#define DP_CFG_H
/*--------------------------------------------------------------------------*/
/* profibus services */
/*--------------------------------------------------------------------------*/
/* todo: setup required services */
/*------------------------------------------*/
/* NOTICE: Only VPC3+/B supports DPV1, DPV2 */
/*------------------------------------------*/
/* DPV1 MSAC1 */
//#define DP_MSAC_C1
/* DPV1 MSAC2 */
//#define DP_MSAC_C2
/* DPV1 Alarms */
//#define DP_ALARM
/* I&M - Identification & Maintenence Functions */
//#define DPV1_IM_SUPP
/* DPV2 */
//#define DP_SUBSCRIBER
//#define DP_DEBUG_ENABLE
/*---------------------------------------------------------------------------*/
/* User defines */
/*---------------------------------------------------------------------------*/
/* todo */
/*-----------------------------------------------------------------------*/
/* general slave parameter */
/*-----------------------------------------------------------------------*/
#define DP_ADDR ((UBYTE)0x07) // Slave address
#define IDENT_NR ((UWORD)0xAFFE) // PROFIBUS Ident Number
#define USER_WD ((UWORD)0x01FF) // User Watchdog
// set watchdog greater than 0x00FF, if serial printouts used
// The UserWatchdog is only active in DataExchange. The UserWatchdog
// isn't timebased, it's a counter of DataExchange-telegrams.
/*-----------------------------------------------------------------------*/
/* define buffer length */
/*-----------------------------------------------------------------------*/
#define DIN_BUFSIZE ((UBYTE)0x20) // Length of the DIn Buffer (Data Slave to Master) 0..244
#define DOUT_BUFSIZE ((UBYTE)0x20) // Length of the DOut Buffer (Data Master to Slave) 0..244
#define PRM_BUFSIZE ((UBYTE)0x40) // Length of the Parameter Buffer 7..244
#define DIAG_BUFSIZE ((UBYTE)0x40) // Length of the Diagnosis Buffer 6..244
#define CFG_BUFSIZE ((UBYTE)0x40) // Length of the Configuration Buffer 1..244
#define SSA_BUFSIZE ((UBYTE)0x00) // Length of the Input Data in the Set_Slave_Address-Buffer 0 and 4..244
// 0: SetSlaveAddress will be deactivated!
/*-----------------------------------------------------------------------*/
/* settings for MSAC_C1 */
/*-----------------------------------------------------------------------*/
#define C1_LEN ((UBYTE)0xF4) // Length of the MSAC_C1 Data
// The parameter specifies the maximum length of user data including
// Function_Num, Slot_number, Index, Length, transferred on the
// MSAC_1 communication channel.
// Type: Unsigned8 (0 .. 244)
/*-----------------------------------------------------------------------*/
/* settings for MSAC_C1 Alarm */
/*-----------------------------------------------------------------------*/
#define DP_ALARM_OVER_SAP50 // Alarm Acknowledge over SAP50
/*-----------------------------------------------------------------------*/
/* settings for MSAC_C2 */
/*-----------------------------------------------------------------------*/
#define DP_MSAC_C2_Time // enables time control for msac-c2
#define C2_NUM_SAPS ((UBYTE)0x03) // Number of MSAC_C2 connections
#define C2_LEN ((UBYTE)0xF4) // Length of MSAC_C2 Data
// The parameter specifies the maximum length of an Initiate Request
// PDU including the Function_Num to the Resource Manager.
// The parameter specifies the maximum length of user data including
// Function_Num, Slot_number, Index, Length, transferred on the
// MSAC_2 communication channel.
// Type: Unsigned8 (0,52.. 244)
#define C2_FEATURES_SUPPORTED_1 ((UBYTE)0x01) // default: 0x01, Read and Write supported
#define C2_FEATURES_SUPPORTED_2 ((UBYTE)0x00) // default: 0x00
#define C2_PROFILE_FEATURES_1 ((UBYTE)0x00) // default: 0x00, vendor or profile specific
#define C2_PROFILE_FEATURES_2 ((UBYTE)0x00) // default: 0x00, vendor or profile specific
#define C2_PROFILE_NUMBER ((UWORD)0x0000) // default: 0x0000, vendor or profile specific
/*-----------------------------------------------------------------------*/
/* settings for DPV2 - Isochron Mode */
/*-----------------------------------------------------------------------*/
#define SYNCH_PULSEWIDTH ((UBYTE)0xFF) // Width of Synchpulse in 1/12祍
/*-----------------------------------------------------------------------*/
/* settings for DPV2 - DXB Subscriber */
/*-----------------------------------------------------------------------*/
#define MAX_LINK_SUPPORTED ((UBYTE)0x05) // Number of Links
#define MAX_DATA_PER_LINK ((UBYTE)0x10) // maximal Number of Data per Link
/*---------------------------------------------------------------------------*/
/* set hardware modes */
/*---------------------------------------------------------------------------*/
#define DP_VPC3_4KB_MODE // (only VPC3+B, VPC3+C)
/*-----------------------------------------------------------------------*/
/* ModeRegister0 (7..0) ( page 15 ) */
/*-----------------------------------------------------------------------*/
//
// bit 7 6 5 4 3 2 1 0
// --------------------------------------------------------------------------
// | Freeze | Sync | Early | Int_Pol | MinTSDR | Res | Dis_Stop | Dis_Start |
// | supp. | supp.| RDY | | | | Control | Control |
// --------------------------------------------------------------------------
// 1 1 0 0 0 0 0 0 = 0xC0 // Default
//
#define INIT_VPC3_MODE_REG_L ((UBYTE)0xC0)
/*-----------------------------------------------------------------------*/
/* ModeRegister0 (15..8) ( page 15 ) */
/*-----------------------------------------------------------------------*/
//
// bit15 14 13 12 11 10 9 8
// ------------------------------------------------------------------------------------
// | Res | PrmCmd | Spec_Clear | Spec_Prm | SetExtPrm | User_Time | EOI_Time | DP |
// | | Supp | Mode | Buf_Mode | Supp | Base | Base | Mode |
// ------------------------------------------------------------------------------------
// 0 0 1 0 0 1 1 1 = 0x27 // Default
//
#define INIT_VPC3_MODE_REG_H ((UBYTE)0x27)
/*-----------------------------------------------------------------------*/
/* ModeRegister2 (7..0) ( page 19 ) (only VPC3+B, VPC3+C) */
/*-----------------------------------------------------------------------*/
//
// bit 7 6 5 4 3 2 1 0
// --------------------------------------------------------------------------------------
// | 4KB | No_Check | SYNC_ | SYNC_ | DX_Int_ | DX_Int_ | No_Check_ | NEW_GC_ |
// | Mode | Prm_Reserved | Pol | ENA | Port | Mode | GC_RESERVED | Int_Mode |
// --------------------------------------------------------------------------------------
// 1 0 0 0 0 0 0 1 = 0x01 or 0x81
//
#ifdef DP_VPC3_4KB_MODE
#define INIT_VPC3_MODE_REG_2 ((UBYTE)0x81)
#else
#define INIT_VPC3_MODE_REG_2 ((UBYTE)0x01)
#endif
/*---------------------------------------------------------------------------*/
/* set interrupt indications */
/*---------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------*/
/* Interrupt Mask Register (7..0) ( page 23 ) */
/*-----------------------------------------------------------------------*/
// bit7 6 5 4 3 2 1 0
// ----------------------------------------------------------------------------------------
// | DXB | New_Ext | DXB_LINK | User_Timer | WD_DP | Baud_Rate | Go/Leave | MAC |
// | OUT | PRM_Data | ERROR | Clock | Mode_Timeout | detect | DataEx | Reset |
// ----------------------------------------------------------------------------------------
// 1 0 1 1 1 1 1 0 = 0xBE // Default
//
#define INIT_VPC3_IND_L 0xBE
/*-----------------------------------------------------------------------*/
/* Interrupt Mask Register (15..8) ( page 23 ) */
/*-----------------------------------------------------------------------*/
// bit 15 14 13 12 11 10 9 8
// -----------------------------------------------------------------------------------
// | REQ_PDU | POLL_END | DX_OUT | Diag_Buffer | New_PRM | NewCfg | NewSSA | NewGC |
// | Ind | Ind | | Changed | Data | Data | Data | Command |
// -----------------------------------------------------------------------------------
// 1 1 1 1 1 1 0 0 = 0xFC // Default
//
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -