...
The same like in ECS SimpleConfig Example exercise. Follow the steps 1 till 3 and use here now netX 90 - EtherCAT Slave - dynamicPDO V3.0.0.0
2. Create a new PDO
(like in the
...
training ECS CustomOD Example exercise)
go to the file: AppECS_DemoObjectDictionary.h
...
Here go to the function AppECS_Write_ObjectInd(...)
Here is a can be found new source code :to recive the syncmanager objects 0x1C12 and 0x1c13.
Code Block | ||
---|---|---|
| ||
uint32_t AppECS_Write_ObjectInd(APP_DATA_T *ptAppData, CIFX_PACKET* ptPkt) { ... switch ( ptInd->tData.usIndex ) { ... case 0x1C12: lRet = OD_WriteInd_PDOAssignmentParameter(&tAppECSData, ptAppData, ptReq); break; case 0x1C13: lRet = OD_WriteInd_PDOAssignmentParameter(&tAppECSData, ptAppData, ptReq); break; default: lRet = CIFX_INVALID_PARAMETER; break; } ... } |
Inside of the fuction OD_WriteInd_PDOAssignmentParameter is the fuction OD_CalculatePdoOffsets() where the application uses the Ecat_SetIoSizeReq.
That means, if the EtherCAT master writes a sync manger, the application needs to check wtich PDO the EhterCAT master wants and caclulate the new size PDO size.
Because of the new 1 Byte 0x1602, add now some code for 0x1602:
Code Block | ||
---|---|---|
| ||
static uint32_t OD_CalculatePdoOffsets(APP_ECS_DATA_T *ptAppEcsData, APP_DATA_T *ptAppData, ODV3_WRITE_OBJECT_REQ_T* ptPck) { ... switch (ptPck->tData.usIndex) { case 0x1C12: { for (j = 0; j < ECS_NUMBER_OF_RX_SUBINDX_INCL_SUB0; j++) { /* add offset of PDO to list and calculate next offset, * usTotalInpuSize was set to 0 before 1st function call*/ ptAppEcsData->tAssignment.tAssign1C12Temp.OffsetInProcessData[j] = ptAppEcsData->usTotalOutputSize; if (ptAppEcsData->tAssignment.tAssign1C12Temp.SubindexEntry[j] == 0x1600) { /* calculate next offset */ ptAppEcsData->usTotalOutputSize += 6; } else if (ptAppEcsData->tAssignment.tAssign1C12Temp.SubindexEntry[j] == 0x1601) { /* calculate next offset */ ptAppEcsData->usTotalOutputSize += 4; } else if (ptAppEcsData->tAssignment.tAssign1C12Temp.SubindexEntry[j] == 0x1602) { /* calculate next offset */ ptAppEcsData->usTotalOutputSize += 1; } } ... } break; ... } return lRet; } |
After OD_CalculatePdoOffsets() the application calls Ecat_SetIoSizeReq()