?? dpdemo.h
字號(hào):
/*****************************************************************************/
/* */
/* 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 1997-2006 */
/* All Rights Reserved */
/* */
/*****************************************************************************/
/*****************************************************************************/
/* */
/* Filename : DPDEMO.H */
/* Version : 5.24 */
/* Date : 31.07.2001 */
/* Author : SOFTING AG */
/* */
/* Description : DP demo application configuration parameters */
/* */
/* CHANGE_NOTES */
/* */
/* */
/*****************************************************************************/
#ifndef __DPDEMO__
#define __DPDEMO__
/****************************************************************************/
/*** DP MASTER BUS PARAMETER SET ********************************************/
/****************************************************************************/
#define DP_MASTER_ADDRESS 2
#define PROFIBOARD_DP_MASTER_IDENT_NUMBER 0xB203
#define PROFICARD_DP_MASTER_IDENT_NUMBER 0xB204
#define DP_MASTER_IDENT_NUMBER PROFIBOARD_DP_MASTER_IDENT_NUMBER
/*--------------------------------------------------------------------------*/
typedef struct _T_DP_IO_DESCR
{
USIGN8 number_inputs;
USIGN8 number_outputs;
USIGN16 offset_inputs;
USIGN16 offset_outputs;
} T_DP_IO_DESCR;
static char exe_fname [_MAX_FNAME]; /* name of .exe file */
static PB_BOOL load_firmware;
static USIGN16 board_number;
static char s [128];
static PB_BOOL prg_done = PB_FALSE;
static INT16 result;
static USIGN8 con_ind_buffer [256];
static USIGN16 con_ind_buffer_len;
static T_PROFI_SERVICE_DESCR con_ind_sdb;
static PB_BOOL slave_diag_requested = PB_FALSE;
static PB_BOOL parallel_service = PB_FALSE;
static T_DP_IO_DESCR io_descr [DP_MAX_NUMBER_SLAVES];
static OCTET FAR dp_bus_para_set [66] =
{
0, 66, /* bus_para_len */
2, /* fdl_add */
DP_KBAUD_12000, /* baud_rate */
0x01, 0x2C, /* Tsl = 300 */
0x00, 0x0F, /* Min Tsdr = 15 */
0x00, 0x96, /* Max Tsdr = 150 */
0, /* Tqui */
1, /* Tset */
0x00, 0x00, 0xC3, 0x50, /* Ttr */
10, /* G */
126, /* HSA */
3, /* max_retry_limit */
DP_BP_ERROR_ACTION,/* DP_BP_ERROR_ACTION, */ /* bp_flag: Autoclear */
0, 1, /* min_slave_interval [100micros] */
0x03, 0xE8, /* poll_timeout = 1000 */
0x00, 0x64, /* data_control_time = 100 */
0, 0, 0, 0, 0, 0, /* reserved [6] */
0x00, DP_MASTER_USER_DATA_LEN, /* master_user_data_len */
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, 0, 0, 0
}; /* dp_bus_para_set */
/****************************************************************************/
/*** DP SLAVE EXAMPLE PARAMETER SETS ****************************************/
/****************************************************************************/
/* */
/* slave_para_len: 16 + */
/* prm_data_len + */
/* cfg_data_len + */
/* aat_data_len + */
/* slave_user_data_len + */
/* number_alignment_bytes */
/* */
/****************************************************************************/
/* */
/*For every slave type an array has to be filled containing all */
/*configuration and parametrization information. */
/* */
/*To append a slave to the list, it is recommended to copy one array, */
/*and to modify the contents according to the data required. */
/* */
/*First the ident_nr will have to be set to its new value. After that, enter*/
/*user_prm_data your slave requires. Next, enter the new configuration */
/*data in the appropriate section. All other elements may remain unchanged */
/*for a first trial. */
/*Finally, you should check all length information (of the array in total */
/*as well as of its substructures). Bear in mind that length information */
/*also has to be counted. */
/*Note: If an empty array was defined, the length would be 0x00, 0x02 as */
/* length information consumes 2 Bytes. */
/* */
/*After the slave has been defined, an address has to be assigned. */
/*This is done in strcuture slave_para_table by replacing the NULL pointer */
/*by a pointer to the appropriate slave_structure. */
/* */
/*The last step is to determine the slaves which are to be polled actively. */
/*This is accomplished by entering the slave_address in to array */
/*dp_slave_table. The last entry of this table must be 0xFF. */
/* */
/*Notes: 1. To include the changes in the .exe you have to recompile */
/* the application. */
/* 2. Error codes being displayed may be looked up in the DP section */
/* manual */
/****************************************************************************/
/****************************************************************************/
/****************************************************************************/
/*--------------------------------------------------------------------------*/
/*--- SIEMENS AG95U --------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*--- DP_PARA_DESCR TABLE --------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*--- STATION ADDRESSES OF ALL TEST SLAVES ---------------------------------*/
/*--------------------------------------------------------------------------*/
static const USIGN8 dp_slave_table [] =
{
3,4,5,6,7,0xFF /* slave addresses; 0xFF == end */
};
/*--------------------------------------------------------------------------*/
/*--- SOFTING PROFIboard/PROFI104 ------------------------------------------*/
/*--------------------------------------------------------------------------*/
static OCTET FAR dp_slave_estun [] =
{
/*--- SLAVE_PARA_SET -----------------------------------------------------*/
0, 38, /* USIGN16: slave_para_len */
DP_SL_ACTIVE | DP_SL_NEW_PRM, /* DP_SL_FLAGSDP_SL_NEW_PRM sl_flag */
DP_SLAVE_TYPE_DP, /* slave_type */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* .....reserved [12] */
/*--- PRM_DATA -----------------------------------------------------------*/
0, 12, /* USIGN16: prm_data_len *///' 2 bytes length+ 7 bytes standard parameter + 3 bytes user_prm data
DP_PRM_STATION_STATUS , /* station_status *///DP_PRM_LOCK_REQ | DP_PRM_WD_ON
1, /* 10ms * wd_fact_1/2 */
100, /* --> 10s */
11, /* min_tsdr */
0xAF, 0xFE, /* USIGN16: ident_number */
5, /* E4group_ident */
0x00,0X0,0X00,
/*--- CFG_DATA -----------------------------------------------------------*/
0, 6, /* USIGN16: cfg_data_len *///len = 2 + anzahl der cfg bytes
0xC1, /* 1 byte input, byte consist. */
0xC8, /* 2 word input, consist. */
0xCC,
0X1, /* 2 byte output, byte consist. */
/*--- AAT_DATA -----------------------------------------------------------*/
0, 2, /* USIGN16: aat_data_len */
/*--- SLAVE_USER_DATA ----------------------------------------------------*/
0, 2, /* USIGN16: slave_user_data_len */
}; /* dp_slave_estun */
static const OCTET FAR* const slave_para_table [] =
{
dp_slave_estun, /* 0 */
dp_slave_estun, /* 1 */
dp_slave_estun, /* 2 */
dp_slave_estun, /* 3 */
dp_slave_estun, /* 4 */
dp_slave_estun, /* 5 */
dp_slave_estun, /* 6 */
dp_slave_estun, /* 7 */
dp_slave_estun, /* 8 */
dp_slave_estun /* 9 */
};
/****************************************************************************/
#endif /* __DPDEMO__ */
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -