?? canopobjdict.h
字號(hào):
/*******************************************************************************
CANopObjDict.h - Variables and Object Dictionary for CANopenNode
Copyright (C) 2004 Janez Paternoster, Slovenia
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author: janez.paternoster@siol.net
History:
2004/06/25 [JP] File Created
2004/08/09 [JP] Changes in manufacturer section, added setup '#defines'
*******************************************************************************/
// This file is not real header file, because it contains variable
// definitions. IT MAY BE INCLUDED ONLY IN CANopDriver.c
#include "CANopDefines.h"
#if (CO_NO_RPDO > 8 || CO_NO_TPDO > 8 || CO_NO_CONS_HEARTBEAT > 8)
#error defineCO_NO_RPDO or defineCO_NO_TPDO or defineCO_NO_CONS_HEARTBEAT too big
#endif
/***** Object Dictionary Entry structure **************************************/
typedef struct {
unsigned int index; // Index of OD entry
unsigned char subindex; // Subindex of OD entry
unsigned char attribute:2; // Attributes RW, WO, RO, CO
unsigned char length; // Data length in bytes
unsigned int pData; // POINTER to data (ram or rom memory)
} CO_objectDictionaryEntry;
/*******************************************************************************
VARIABLES USED IN OBJECT DICTIONARY
********************************************************************************
Two types of variables:
- variables allocated in program memory flash space (ROM variables);
- variables allocated in RAM space.
Features of ROM variables:
- keep value after power off,
- intialization values are writen when chip is being programmed,
- readable as usual variables,
- values can be changed in run time with SDO object.
How to differentiate ROM and RAM variable pointers:
- in PIC18Fxx8 RAM is addressed from 0...0xFFF and ROM from 0...0xFFFF
- to use one pointer for both types of variables there is a little trick:
Place all ROM variables above address 0x1000. When reading a variable
through pointer, fist check pointer value and then use RAM or ROM pointer.
All ROM variables used in object dictionary MUST be above address 0x1000!!!
*******************************************************************************/
#pragma romdata ODE_RomVariables=0x1000 //this line has no influence on RAM variables
/******************************************************************************/
/* Standard Object Dictionary Entries ********************************/
/******************************************************************************/
/***** Communication profile: ************************/
/******* Index 0x1000 ** Mandatory *******************/
rom UNSIGNED32 ODE_Device_Type = ODD_DEVICE_TYPE;
//bit 0-15: Device profile number
//bit 16-31: Additional information
/******* Index 0x1001 ** Mandatory *******************/
UNSIGNED8 ODE_Error_Register = 0;
//see errors.h
/******* Index 0x1002 ********************************/
UNSIGNED32 ODE_Manufacturer_Status_Register = 0L;
#if CO_NO_ERROR_FIELD > 0
/******* Index 0x1003 ********************************/
UNSIGNED8 ODE_Pre_Defined_Error_Field_NoOfErrors = 0;
UNSIGNED32 ODE_Pre_Defined_Error_Field[CO_NO_ERROR_FIELD];
//bit 0-15: Error code as transmitted in the Emergency object
//bit 16-31: Manufacturer specific
#endif
/******* Index 0x1005 ********************************/
rom UNSIGNED32 ODE_SYNC_COB_ID =
#ifdef ODD_SYNC_PRODUCER
0x40000080L;
#else
0x00000080L;
#endif
//bit 0-10: COB ID for SYNC object
//bit 11-29: set to 0
//bit 30: 1(0) - node generates (does NOT generate) SYNC object
//bit 31: set to 0
/******* Index 0x1006 ********************************/
rom UNSIGNED32 ODE_Communication_Cycle_Period = ODD_COMM_CYCLE_PERIOD;
//period of SYNC transmition
//(in microseconds) (0 = no transmition, no checking)
/******* Index 0x1007 ********************************/
rom UNSIGNED32 ODE_Synchronous_Window_Length = ODD_SYNCHR_WINDOW_LEN;
//window leghth after SYNC when PDOS must be transmitted
//(in microseconds), (0 = not used)
/******* Index 0x1008 ********************************/
rom char ODE_Manufacturer_Device_Name[4] = {ODD_MANUF_DEVICE_NAME};
/******* Index 0x1009 ********************************/
rom char ODE_Manufacturer_Hardware_Version[4] = {ODD_MANUF_HW_VERSION};
/******* Index 0x100A ********************************/
rom char ODE_Manufacturer_Software_Version[4] = {ODD_MANUF_SW_VERSION};
/******* Index 0x1014 ********************************/
UNSIGNED32 ODE_Emergency_COB_ID; //value is set at CANInit;
//bit 0-10: COB ID
//bit 11-30: set to 0 for 11 bit COB ID
//bit 31: 0(1) - node uses (does NOT use) Emergency object
/******* Index 0x1015 ********************************/
rom UNSIGNED16 ODE_Inhibit_Time_Emergency = ODD_INHIBIT_TIME_EMER;
//inhibit time of emergency message in 100 microseconds
/******* Index 0x1016 ********************************/
#if CO_NO_CONS_HEARTBEAT > 0
rom UNSIGNED8 ODE_Consumer_Heartbeat_Time_NoOfEntries = CO_NO_CONS_HEARTBEAT;
rom UNSIGNED32 ODE_Consumer_Heartbeat_Time[CO_NO_CONS_HEARTBEAT] =
{ODD_CONS_HEARTBEAT_1,
#if CO_NO_CONS_HEARTBEAT > 1
ODD_CONS_HEARTBEAT_2,
#endif
#if CO_NO_CONS_HEARTBEAT > 2
ODD_CONS_HEARTBEAT_3,
#endif
#if CO_NO_CONS_HEARTBEAT > 3
ODD_CONS_HEARTBEAT_4,
#endif
#if CO_NO_CONS_HEARTBEAT > 4
ODD_CONS_HEARTBEAT_5,
#endif
#if CO_NO_CONS_HEARTBEAT > 5
ODD_CONS_HEARTBEAT_6,
#endif
#if CO_NO_CONS_HEARTBEAT > 6
ODD_CONS_HEARTBEAT_7,
#endif
#if CO_NO_CONS_HEARTBEAT > 7
ODD_CONS_HEARTBEAT_8,
#endif
};
#endif
//bit 0-15: heartbit consumer time in ms (0 = node is not monitored)
//bit 16-23: Node ID
//bit 24-31: set to 0
/******* Index 0x1017 ********************************/
rom UNSIGNED16 ODE_Producer_Heartbeat_Time = ODD_PROD_HEARTBEAT;
//heartbit producer time in ms (0 = disable transmition)
/******* Index 0x1018 ** Mandatory *******************/
rom struct{
UNSIGNED8 NoOfEntries;
UNSIGNED32 Vendor_ID;
UNSIGNED32 Product_Code;
UNSIGNED32 Revision_Number;
UNSIGNED32 Serial_Number;
} ODE_Identity = {4, ODD_IDENT_VENDOR_ID, ODD_IDENT_PROD_CODE,
ODD_IDENT_REVISION_NR, ODD_IDENT_SERIAL_NR};
/** SERVICE DATA OBJECTS *****************************/
/******* Index 0x1200 ********************************/
struct{
UNSIGNED8 NoOfEntries;
UNSIGNED32 COB_ID_Client_to_Server;
UNSIGNED32 COB_ID_Server_to_Client;
} ODE_Server_SDO_Parameter = {2};//values are set at CANInit;
/** PROCESS DATA OBJECTS *****************************/
typedef struct{
UNSIGNED8 NoOfEntries;
UNSIGNED32 COB_ID;
//bit 0-10: COB ID for PDO
//bit 11-29: set to 0 for 11 bit COB ID
//bit 30: 0(1) - rtr are allowed (are NOT allowed) for PDO
//bit 31: 0(1) - node uses (does NOT use) PDO
UNSIGNED8 Transmission_type;
//value = 1-240: reciving is synchronous, process after next reception of SYNC object,
// transmitting is synchronous after every N-th SYNC object, N==value.
//value = 0, 255: specification in device profile
//value = 254: manufacturer specific
//value = 241-253: not used
} sPDO_param;
typedef struct{
UNSIGNED8 NoOfEntries; //numeber of objects mapped into the PDO
UNSIGNED32 Map[CO_PDO_MAP_SIZE];
//value in map is constructed: 0xIIIISSDD
//IIII = index from OD, SS = subindex, DD = data length in bits
} sPDO_map;
/******* Index 0x1400 ********************************/
#if CO_NO_RPDO > 0
rom sPDO_param ODE_RPDO_Parameter[CO_NO_RPDO] =
{2, ODD_RPDO_PAR_COB_ID_0, 1,
#if CO_NO_RPDO > 1
2, ODD_RPDO_PAR_COB_ID_1, 1,
#endif
#if CO_NO_RPDO > 2
2, ODD_RPDO_PAR_COB_ID_2, 1,
#endif
#if CO_NO_RPDO > 3
2, ODD_RPDO_PAR_COB_ID_3, 1,
#endif
#if CO_NO_RPDO > 4
2, ODD_RPDO_PAR_COB_ID_4, 1,
#endif
#if CO_NO_RPDO > 5
2, ODD_RPDO_PAR_COB_ID_5, 1,
#endif
#if CO_NO_RPDO > 6
2, ODD_RPDO_PAR_COB_ID_6, 1,
#endif
#if CO_NO_RPDO > 7
2, ODD_RPDO_PAR_COB_ID_7, 1,
#endif
};
#endif
/******* Index 0x1800 ********************************/
#if CO_NO_TPDO > 0
rom sPDO_param ODE_TPDO_Parameter[CO_NO_TPDO] =
{2, ODD_TPDO_PAR_COB_ID_0, ODD_TPDO_PAR_T_TYPE_0,
#if CO_NO_TPDO > 1
2, ODD_TPDO_PAR_COB_ID_1, ODD_TPDO_PAR_T_TYPE_1,
#endif
#if CO_NO_TPDO > 2
2, ODD_TPDO_PAR_COB_ID_2, ODD_TPDO_PAR_T_TYPE_2,
#endif
#if CO_NO_TPDO > 3
2, ODD_TPDO_PAR_COB_ID_3, ODD_TPDO_PAR_T_TYPE_3,
#endif
#if CO_NO_TPDO > 4
2, ODD_TPDO_PAR_COB_ID_4, ODD_TPDO_PAR_T_TYPE_4,
#endif
#if CO_NO_TPDO > 5
2, ODD_TPDO_PAR_COB_ID_5, ODD_TPDO_PAR_T_TYPE_5,
#endif
#if CO_NO_TPDO > 6
2, ODD_TPDO_PAR_COB_ID_6, ODD_TPDO_PAR_T_TYPE_6,
#endif
#if CO_NO_TPDO > 7
2, ODD_TPDO_PAR_COB_ID_7, ODD_TPDO_PAR_T_TYPE_7,
#endif
};
#endif
#if CO_PDO_MAP_SIZE == 2
/******* Index 0x1600 ********************************/
#if CO_NO_RPDO > 0
rom sPDO_map ODE_RPDO_Mapping[CO_NO_RPDO] =
{2, ODD_RPDO_MAP_0_1, ODD_RPDO_MAP_0_2,
#if CO_NO_RPDO > 1
2, ODD_RPDO_MAP_1_1, ODD_RPDO_MAP_1_2,
#endif
#if CO_NO_RPDO > 2
2, ODD_RPDO_MAP_2_1, ODD_RPDO_MAP_2_2,
#endif
#if CO_NO_RPDO > 3
2, ODD_RPDO_MAP_3_1, ODD_RPDO_MAP_3_2,
#endif
#if CO_NO_RPDO > 4
2, ODD_RPDO_MAP_4_1, ODD_RPDO_MAP_4_2,
#endif
#if CO_NO_RPDO > 5
2, ODD_RPDO_MAP_5_1, ODD_RPDO_MAP_5_2,
#endif
#if CO_NO_RPDO > 6
2, ODD_RPDO_MAP_6_1, ODD_RPDO_MAP_6_2,
#endif
#if CO_NO_RPDO > 7
2, ODD_RPDO_MAP_7_1, ODD_RPDO_MAP_7_2,
#endif
};
#endif
/******* Index 0x1A00 ********************************/
#if CO_NO_TPDO > 0
rom sPDO_map ODE_TPDO_Mapping[CO_NO_TPDO] =
{2, ODD_TPDO_MAP_0_1, ODD_TPDO_MAP_0_2,
#if CO_NO_TPDO > 1
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -