In EtherCAT it is possible to configure object entries larger than 30 bytes. For example, subindexes configured as arrays with more than 30 elements defined using the OCTET STRING datatype. In this case, the first 30 bytes shall be mapped to the configured subindex and the remaining bytes shall be mapped to the next subindex. This feature is demonstrated by creating an array object with 51 bytes and mapping to RXPDO.
Creating a large object
Create a variable object at index 0x3001 as an array with 51 elements defined with OCTETSTRING data type.
ptSlave,
0x3001,
"Variable - DEFTYPE-OCTET_STRING",
8*(51),
NULL,
NULL,
NULL,
NULL);
uint32_t EC_API_SLV_CoE_odAddVariable(EC_API_SLV_SHandle_t *pHandle, uint16_t index, char *pName, uint16_t type, uint16_t bitLen, uint16_t flags, EC_API_SLV_CBObjRead_t cbRead, void *pReadCtxt, EC_API_SLV_CBObjWrite_t cbWrite, void *pWriteCtxt)
This function creates a Base Data Type Object for the Object Dictionary.
Definition ecSlvApi_CoE.c:1606
#define ACCESS_READWRITE
Read/write in all states.
Definition ecSlvApiDef_CoE.h:134
#define OBJACCESS_TXPDOMAPPING
Mappable in TxPDOs.
Definition ecSlvApiDef_CoE.h:145
#define OBJACCESS_RXPDOMAPPING
Mappable in RxPDOs.
Definition ecSlvApiDef_CoE.h:144
#define DEFTYPE_OCTETSTRING
OCTET_STRING.
Definition ecSlvApiDef_CoE.h:49
Mapping large object to RxPDO
Map the above created object to RxPDO created at index 0x1602.
ptSlave,
pApplicationInstance_p->ptRxPdo1602,
"OCTET STRING ARRAY",
ptObjEntry);
uint32_t EC_API_SLV_CoE_getObjectEntry(EC_API_SLV_SHandle_t *pHandle, uint16_t index, uint8_t subIndex, EC_API_SLV_SCoE_ObjEntry_t **ppObjectEntry)
This function returns object entries from the Object Dictionary.
Definition ecSlvApi_CoE.c:661
uint32_t EC_API_SLV_PDO_create(EC_API_SLV_SHandle_t *pHandle, char *pName, uint16_t mapIndex, EC_API_SLV_Pdo_t **pOutPdo)
Creates an empty PDO.
Definition ecSlvApi_pdo.c:416
uint32_t EC_API_SLV_PDO_createEntry(EC_API_SLV_SHandle_t *pHandle, EC_API_SLV_Pdo_t *pPdo, char *pName, EC_API_SLV_SCoE_ObjEntry_t *pObjEntry)
This function maps an object entry from the Object Dictionary as a PDO.
Definition ecSlvApi_pdo.c:827
RxPDO object in TwinCAT
The below diagram shows the RxPDO object in the CoE online tab in TwinCAT. The first 30 bytes (240 bits) are mapped to subindex 01 and the remaining 21 bytes (168 bits) are mapped to subindex 02. Note that index is 0x0000 in the value column of the subindex 02 as a result of large object padding.
RxPDO3 mapping in TwinCAT
The below diagram shows the RxPDO object in the process data tab in TwinCAT. Observe the Index,size and offset values in PDO content.
Process data object content view in TwinCAT