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

📄 canopobjdict.h

📁 开放源码的CanOpen源码(C)
💻 H
📖 第 1 页 / 共 3 页
字号:
                         2, ODD_TPDO_MAP_1_1, ODD_TPDO_MAP_1_2,
      #endif
      #if CO_NO_TPDO > 2
                         2, ODD_TPDO_MAP_2_1, ODD_TPDO_MAP_2_2,
      #endif
      #if CO_NO_TPDO > 3
                         2, ODD_TPDO_MAP_3_1, ODD_TPDO_MAP_3_2,
      #endif
      #if CO_NO_TPDO > 4
                         2, ODD_TPDO_MAP_4_1, ODD_TPDO_MAP_4_2,
      #endif
      #if CO_NO_TPDO > 5
                         2, ODD_TPDO_MAP_5_1, ODD_TPDO_MAP_5_2,
      #endif
      #if CO_NO_TPDO > 6
                         2, ODD_TPDO_MAP_6_1, ODD_TPDO_MAP_6_2,
      #endif
      #if CO_NO_TPDO > 7
                         2, ODD_TPDO_MAP_7_1, ODD_TPDO_MAP_7_2,
      #endif
                         };
   #endif
   
#elif CO_PDO_MAP_SIZE == 8
   #if CO_NO_RPDO > 0
      rom sPDO_map   ODE_RPDO_Mapping[CO_NO_RPDO];
   #endif
   #if CO_NO_TPDO > 0
      rom sPDO_map   ODE_TPDO_Mapping[CO_NO_TPDO];
   #endif
#else
   #error define_CO_PDO_MAP_SIZE CO_PDO_MAP_SIZE not supported
#endif

                
/** OTHER ********************************************/
/******* Index 0x1F80 ********************************/
rom UNSIGNED32 ODE_NMT_Startup = 
#ifdef ODD_BOOT_OPERATIONAL
                  0x00;
#else
                  0x04;
#endif
               //bit     2: 0(1) - automaticaly enter (DO NOT automaticaly enter) 
               //                  the operational state on bootup
               //bit 0,1,3,4,5,6: see ds301 (here sholud be set to 0)
               //bit  7-31: reserved, set to 0
               
               
/******************************************************************************/
/*     Manufacturer specific Variables      ***********************************/
/******************************************************************************/
/******* Index 0x2100 ********************************/
rom UNSIGNED8  ODE_ErrorStatusBitsNoOfEntries = 5; //5...32 see errors.h
    UNSIGNED8  ODE_ErrorStatusBits[5] = {0, 0, 0, 0, 0};           
                              
/******* Index 0x2101 ********************************/
//this entery should be replaced with DIP switches on printed board
    UNSIGNED8  ODE_CANnodeID = CO_DEFAULT_NODE_ID;

/******* Index 0x2102 ********************************/
//this entery should be replaced with DIP switches on printed board
    UNSIGNED8  ODE_CANbitRate = CO_DEFAULT_BIT_RATE;

/******* Index 0x2103 ********************************/
    UNSIGNED16 ODE_SYNCcounter;  //updated in both interrupts
               //intialized at CAN init, incremented at every SYNC object
               
/******* Index 0x2104 ********************************/
    UNSIGNED16 ODE_SYNCtime;     //updated in both interrupts
               //time in [ms] since last SYNC object
    
/******* Index 0x2105 ********************************/
   extern volatile near unsigned char       RCON;
               //RCON register in PIC18Fxxx (reset status bits)
    

/******* EEPROM DATA *********************************/
//Data in following structure is read at chip intialisation
//and is written automatically when it is changed.    
struct{
               /******* Index 0x2106 *****************/
    UNSIGNED32 PowerOnCounter;
               //Incremented every time, chip is powered.
               
               
}ODE_EEPROM;    


/** PDO Data *****************************************/
// Can be mapped to any indexes in object dictionary
// See union tData8bytes for fragmentation (can be 
// used as 1byte, 2bytes or 4 bytes lengths).
// Mapping is static.
// By default, they are mapped to 0x2110 and 0x2111
#if CO_NO_RPDO > 0
 rom UNSIGNED8  ODE_RPDO_NoOfEntries = CO_NO_RPDO*2;
 extern volatile tData8bytes CO_RPDO[CO_NO_RPDO];
#endif

#if CO_NO_TPDO > 0
 rom UNSIGNED8  ODE_TPDO_NoOfEntries = CO_NO_TPDO*2;
 extern volatile tData8bytes CO_TPDO[CO_NO_TPDO];
#endif


/******************************************************************************/
/*     OBJECT DICTIONARY      *************************************************/
/******************************************************************************/
/* sections of Object Dictionary: *********************************************/
//       0x0000           Reserved
//       0x0001 - 0x025F  Data type definitions     
//       0x0260 - 0x0FFF  Reserved
//       0x1000 - 0x1FFF  Communication profile
//       0x2000 - 0x5FFF  Manufacturer specific
//       0x6000 - 0x9FFF  Standardized device profile
//       0xA000 - 0xBFFF  Standardized interface profile
//       0xC000 - 0xFFFF  Reserved
/* LIMITATIONS: ***************************************************************/
//    max entry data size = 4 bytes
/******************************************************************************/
#define OD_ENTRY(index, subindex, attribute, variable) \
        {index, subindex, attribute, sizeof(variable), (unsigned int)&variable}

const rom CO_objectDictionaryEntry CO_OD[] = {
/***** Communication profile: *************************************************/
   OD_ENTRY(0x1000, 0x00, ATTR_RO, ODE_Device_Type),
   OD_ENTRY(0x1001, 0x00, ATTR_RO, ODE_Error_Register),
   OD_ENTRY(0x1002, 0x00, ATTR_RO, ODE_Manufacturer_Status_Register),
   
#if CO_NO_ERROR_FIELD > 0
      OD_ENTRY(0x1003, 0x00, ATTR_RW, ODE_Pre_Defined_Error_Field_NoOfErrors),
      OD_ENTRY(0x1003, 0x01, ATTR_RO, ODE_Pre_Defined_Error_Field[0]),
   #if CO_NO_ERROR_FIELD > 1
      OD_ENTRY(0x1003, 0x02, ATTR_RO, ODE_Pre_Defined_Error_Field[1]),
   #endif
   #if CO_NO_ERROR_FIELD > 2
      OD_ENTRY(0x1003, 0x03, ATTR_RO, ODE_Pre_Defined_Error_Field[2]),
   #endif
   #if CO_NO_ERROR_FIELD > 3
      OD_ENTRY(0x1003, 0x04, ATTR_RO, ODE_Pre_Defined_Error_Field[3]),
   #endif
   #if CO_NO_ERROR_FIELD > 4
      OD_ENTRY(0x1003, 0x05, ATTR_RO, ODE_Pre_Defined_Error_Field[4]),
   #endif
   #if CO_NO_ERROR_FIELD > 5
      OD_ENTRY(0x1003, 0x06, ATTR_RO, ODE_Pre_Defined_Error_Field[5]),
   #endif
   #if CO_NO_ERROR_FIELD > 6
      OD_ENTRY(0x1003, 0x07, ATTR_RO, ODE_Pre_Defined_Error_Field[6]),
   #endif
   #if CO_NO_ERROR_FIELD > 7
      OD_ENTRY(0x1003, 0x08, ATTR_RO, ODE_Pre_Defined_Error_Field[7]),
   #endif
#endif

   OD_ENTRY(0x1005, 0x00, ATTR_RW, ODE_SYNC_COB_ID),
   OD_ENTRY(0x1006, 0x00, ATTR_RW, ODE_Communication_Cycle_Period),
   OD_ENTRY(0x1007, 0x00, ATTR_RW, ODE_Synchronous_Window_Length),
   OD_ENTRY(0x1008, 0x00, ATTR_RO, ODE_Manufacturer_Device_Name),
   OD_ENTRY(0x1009, 0x00, ATTR_RO, ODE_Manufacturer_Hardware_Version),
   OD_ENTRY(0x100A, 0x00, ATTR_RO, ODE_Manufacturer_Software_Version),
   OD_ENTRY(0x1014, 0x00, ATTR_RO, ODE_Emergency_COB_ID),
   OD_ENTRY(0x1015, 0x00, ATTR_RW, ODE_Inhibit_Time_Emergency),
   
#if CO_NO_CONS_HEARTBEAT > 0
      OD_ENTRY(0x1016, 0x00, ATTR_RO, ODE_Consumer_Heartbeat_Time_NoOfEntries),
      OD_ENTRY(0x1016, 0x01, ATTR_RW, ODE_Consumer_Heartbeat_Time[0]),
   #if CO_NO_CONS_HEARTBEAT > 1
      OD_ENTRY(0x1016, 0x02, ATTR_RW, ODE_Consumer_Heartbeat_Time[1]),
   #endif
   #if CO_NO_CONS_HEARTBEAT > 2
      OD_ENTRY(0x1016, 0x03, ATTR_RW, ODE_Consumer_Heartbeat_Time[2]),
   #endif
   #if CO_NO_CONS_HEARTBEAT > 3
      OD_ENTRY(0x1016, 0x04, ATTR_RW, ODE_Consumer_Heartbeat_Time[3]),
   #endif
   #if CO_NO_CONS_HEARTBEAT > 4
      OD_ENTRY(0x1016, 0x05, ATTR_RW, ODE_Consumer_Heartbeat_Time[4]),
   #endif
   #if CO_NO_CONS_HEARTBEAT > 5
      OD_ENTRY(0x1016, 0x06, ATTR_RW, ODE_Consumer_Heartbeat_Time[5]),
   #endif
   #if CO_NO_CONS_HEARTBEAT > 6
      OD_ENTRY(0x1016, 0x07, ATTR_RW, ODE_Consumer_Heartbeat_Time[6]),
   #endif
   #if CO_NO_CONS_HEARTBEAT > 7
      OD_ENTRY(0x1016, 0x08, ATTR_RW, ODE_Consumer_Heartbeat_Time[7]),
   #endif
#endif

   OD_ENTRY(0x1017, 0x00, ATTR_RW, ODE_Producer_Heartbeat_Time),
   OD_ENTRY(0x1018, 0x00, ATTR_RO, ODE_Identity.NoOfEntries),
   OD_ENTRY(0x1018, 0x01, ATTR_RO, ODE_Identity.Vendor_ID),
   OD_ENTRY(0x1018, 0x02, ATTR_RO, ODE_Identity.Product_Code),
   OD_ENTRY(0x1018, 0x03, ATTR_RO, ODE_Identity.Revision_Number),
   OD_ENTRY(0x1018, 0x04, ATTR_RO, ODE_Identity.Serial_Number),
   
   //SDOs
   OD_ENTRY(0x1200, 0x00, ATTR_RO, ODE_Server_SDO_Parameter.NoOfEntries),
   OD_ENTRY(0x1200, 0x01, ATTR_RO, ODE_Server_SDO_Parameter.COB_ID_Client_to_Server),
   OD_ENTRY(0x1200, 0x02, ATTR_RO, ODE_Server_SDO_Parameter.COB_ID_Server_to_Client),
   
   //PDOs
#ifdef CO_PDO_PARAM_IN_OD
   #if CO_NO_RPDO > 0
      OD_ENTRY(0x1400, 0x00, ATTR_RO, ODE_RPDO_Parameter[0].NoOfEntries),
      OD_ENTRY(0x1400, 0x01, ATTR_RW, ODE_RPDO_Parameter[0].COB_ID),
      OD_ENTRY(0x1400, 0x02, ATTR_RO, ODE_RPDO_Parameter[0].Transmission_type),
   #endif
   #if CO_NO_RPDO > 1
      OD_ENTRY(0x1401, 0x00, ATTR_RO, ODE_RPDO_Parameter[1].NoOfEntries),
      OD_ENTRY(0x1401, 0x01, ATTR_RW, ODE_RPDO_Parameter[1].COB_ID),
      OD_ENTRY(0x1401, 0x02, ATTR_RO, ODE_RPDO_Parameter[1].Transmission_type),
   #endif
   #if CO_NO_RPDO > 2
      OD_ENTRY(0x1402, 0x00, ATTR_RO, ODE_RPDO_Parameter[2].NoOfEntries),
      OD_ENTRY(0x1402, 0x01, ATTR_RW, ODE_RPDO_Parameter[2].COB_ID),
      OD_ENTRY(0x1402, 0x02, ATTR_RO, ODE_RPDO_Parameter[2].Transmission_type),
   #endif
   #if CO_NO_RPDO > 3
      OD_ENTRY(0x1403, 0x00, ATTR_RO, ODE_RPDO_Parameter[3].NoOfEntries),
      OD_ENTRY(0x1403, 0x01, ATTR_RW, ODE_RPDO_Parameter[3].COB_ID),
      OD_ENTRY(0x1403, 0x02, ATTR_RO, ODE_RPDO_Parameter[3].Transmission_type),
   #endif
   #if CO_NO_RPDO > 4
      OD_ENTRY(0x1404, 0x00, ATTR_RO, ODE_RPDO_Parameter[4].NoOfEntries),
      OD_ENTRY(0x1404, 0x01, ATTR_RW, ODE_RPDO_Parameter[4].COB_ID),
      OD_ENTRY(0x1404, 0x02, ATTR_RO, ODE_RPDO_Parameter[4].Transmission_type),
   #endif
   #if CO_NO_RPDO > 5
      OD_ENTRY(0x1405, 0x00, ATTR_RO, ODE_RPDO_Parameter[5].NoOfEntries),
      OD_ENTRY(0x1405, 0x01, ATTR_RW, ODE_RPDO_Parameter[5].COB_ID),
      OD_ENTRY(0x1405, 0x02, ATTR_RO, ODE_RPDO_Parameter[5].Transmission_type),
   #endif
   #if CO_NO_RPDO > 6
      OD_ENTRY(0x1406, 0x00, ATTR_RO, ODE_RPDO_Parameter[6].NoOfEntries),
      OD_ENTRY(0x1406, 0x01, ATTR_RW, ODE_RPDO_Parameter[6].COB_ID),
      OD_ENTRY(0x1406, 0x02, ATTR_RO, ODE_RPDO_Parameter[6].Transmission_type),
   #endif
   #if CO_NO_RPDO > 7
      OD_ENTRY(0x1407, 0x00, ATTR_RO, ODE_RPDO_Parameter[7].NoOfEntries),
      OD_ENTRY(0x1407, 0x01, ATTR_RW, ODE_RPDO_Parameter[7].COB_ID),
      OD_ENTRY(0x1407, 0x02, ATTR_RO, ODE_RPDO_Parameter[7].Transmission_type),
   #endif
   
   #if CO_NO_TPDO > 0
      OD_ENTRY(0x1800, 0x00, ATTR_RO, ODE_TPDO_Parameter[0].NoOfEntries),
      OD_ENTRY(0x1800, 0x01, ATTR_RW, ODE_TPDO_Parameter[0].COB_ID),
      OD_ENTRY(0x1800, 0x02, ATTR_RW, ODE_TPDO_Parameter[0].Transmission_type),
   #endif
   #if CO_NO_TPDO > 1
      OD_ENTRY(0x1801, 0x00, ATTR_RO, ODE_TPDO_Parameter[1].NoOfEntries),
      OD_ENTRY(0x1801, 0x01, ATTR_RW, ODE_TPDO_Parameter[1].COB_ID),
      OD_ENTRY(0x1801, 0x02, ATTR_RW, ODE_TPDO_Parameter[1].Transmission_type),
   #endif
   #if CO_NO_TPDO > 2
      OD_ENTRY(0x1802, 0x00, ATTR_RO, ODE_TPDO_Parameter[2].NoOfEntries),
      OD_ENTRY(0x1802, 0x01, ATTR_RW, ODE_TPDO_Parameter[2].COB_ID),
      OD_ENTRY(0x1802, 0x02, ATTR_RW, ODE_TPDO_Parameter[2].Transmission_type),
   #endif
   #if CO_NO_TPDO > 3
      OD_ENTRY(0x1803, 0x00, ATTR_RO, ODE_TPDO_Parameter[3].NoOfEntries),
      OD_ENTRY(0x1803, 0x01, ATTR_RW, ODE_TPDO_Parameter[3].COB_ID),
      OD_ENTRY(0x1803, 0x02, ATTR_RW, ODE_TPDO_Parameter[3].Transmission_type),
   #endif
   #if CO_NO_TPDO > 4
      OD_ENTRY(0x1804, 0x00, ATTR_RO, ODE_TPDO_Parameter[4].NoOfEntries),
      OD_ENTRY(0x1804, 0x01, ATTR_RW, ODE_TPDO_Parameter[4].COB_ID),
      OD_ENTRY(0x1804, 0x02, ATTR_RW, ODE_TPDO_Parameter[4].Transmission_type),
   #endif
   #if CO_NO_TPDO > 5
      OD_ENTRY(0x1805, 0x00, ATTR_RO, ODE_TPDO_Parameter[5].NoOfEntries),
      OD_ENTRY(0x1805, 0x01, ATTR_RW, ODE_TPDO_Parameter[5].COB_ID),
      OD_ENTRY(0x1805, 0x02, ATTR_RW, ODE_TPDO_Parameter[5].Transmission_type),
   #endif
   #if CO_NO_TPDO > 6
      OD_ENTRY(0x1806, 0x00, ATTR_RO, ODE_TPDO_Parameter[6].NoOfEntries),
      OD_ENTRY(0x1806, 0x01, ATTR_RW, ODE_TPDO_Parameter[6].COB_ID),
      OD_ENTRY(0x1806, 0x02, ATTR_RW, ODE_TPDO_Parameter[6].Transmission_type),
   #endif
   #if CO_NO_TPDO > 7
      OD_ENTRY(0x1807, 0x00, ATTR_RO, ODE_TPDO_Parameter[7].NoOfEntries),
      OD_ENTRY(0x1807, 0x01, ATTR_RW, ODE_TPDO_Parameter[7].COB_ID),
      OD_ENTRY(0x1807, 0x02, ATTR_RW, ODE_TPDO_Parameter[7].Transmission_type),
   #endif
#endif //end CO_PDO_PARAM_IN_OD

#ifdef CO_PDO_MAPPING_IN_OD
   #if (CO_PDO_MAP_SIZE == 2 || CO_PDO_MAP_SIZE == 8)
    #if CO_NO_RPDO > 0
      OD_ENTRY(0x1600, 0x00, ATTR_RO, ODE_RPDO_Mapping[0].NoOfEntries),
      OD_ENTRY(0x1600, 0x01, ATTR_RO, ODE_RPDO_Mapping[0].Map[0]),
      OD_ENTRY(0x1600, 0x02, ATTR_RO, ODE_RPDO_Mapping[0].Map[1]),
    #endif
    #if CO_NO_RPDO > 1
      OD_ENTRY(0x1601, 0x00, ATTR_RO, ODE_RPDO_Mapping[1].NoOfEntries),
      OD_ENTRY(0x1601, 0x01, ATTR_RO, ODE_RPDO_Mapping[1].Map[0]),
      OD_ENTRY(0x1601, 0x02, ATTR_RO, ODE_RPDO_Mapping[1].Map[1]),
    #endif
    #if CO_NO_RPDO > 2
      OD_ENTRY(0x1602, 0x00, ATTR_RO, ODE_RPDO_Mapping[2].NoOfEntries),

⌨️ 快捷键说明

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