EtherCAT Slave  1.06.01

◆ EC_API_SLV_CoE_odAddVariable()

uint32_t EC_API_SLV_CoE_odAddVariable ( EC_API_SLV_SHandle_t pEcSlaveApi_p,
uint16_t  index_p,
char *  pName_p,
uint16_t  type_p,
uint16_t  bitLen_p,
uint16_t  flags_p,
EC_API_SLV_CBObjRead_t  cbRead_p,
void *  pReadCtxt_p,
EC_API_SLV_CBObjWrite_t  cbWrite_p,
void *  pWriteCtxt_p 
)

This function creates a Base Data Type Object for the Object Dictionary.

Parameters
[in]pEcSlaveApi_pThe pointer to the EtherCAT API instance.
[in]index_pArray index number.
[in]pName_pEntry name.
[in]type_pBase type (USINT, UDINT...).
[in]bitLen_pBit length of the data type.
[in]flags_pRead, Write, PDO Mapping and other flags.
[in]cbRead_pRead function pointer to the read function.
[in]pReadCtxt_pRead function pointer to the read function context.
[in]cbWrite_pWrite function pointer to the write function.
[in]pWriteCtxt_pRead function pointer to the read function context.
Returns
uint32_t Returns the API error code.
Example
#include <ecSlvApi.h>
// required variables
uint32_t retVal = 0;
// the Call
retVal = EC_API_SLV_CoE_odAddVariable(ptEcSlvApi, 0x2001, "Test Variable", DEFTYPE_INTEGER32, 32, ACCESS_READWRITE, NULL, NULL);
Examples
ESL_cia402Obd.c.
EC_API_SLV_CoE_odAddVariable
uint32_t EC_API_SLV_CoE_odAddVariable(EC_API_SLV_SHandle_t *pEcSlaveApi_p, uint16_t index_p, char *pName_p, uint16_t type_p, uint16_t bitLen_p, uint16_t flags_p, EC_API_SLV_CBObjRead_t cbRead_p, void *pReadCtxt_p, EC_API_SLV_CBObjWrite_t cbWrite_p, void *pWriteCtxt_p)
This function creates a Base Data Type Object for the Object Dictionary.
Definition: ecSlvApi_CoEStub.c:624
ACCESS_READWRITE
#define ACCESS_READWRITE
Read/write in all states.
Definition: ecApiDef.h:132
DEFTYPE_INTEGER32
#define DEFTYPE_INTEGER32
INTEGER32.
Definition: ecApiDef.h:68