Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Necessary hardware and sotware for this training

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

...

That means, if the EtherCAT master writes a sync mangerobject to the ECS slave, the slave application will get this object and it needs to check wtich PDO the EhterCAT master wants and . The Slave applicaton caclulate the new size PDO size .Because of the new 1 Byte 0x1602, add now some code for and uses Ecat_SetIoSizeReq() to tell the stack this.

With the sourcode chages now the application has the PDO 0x1602 with one Byte. I is necessary to change the OD_CalculatePdoOffsets() to support the new PDO 0x1602:

Code Block
languagecpp
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;
}

...

go to file AppECS_DemoApplication.h and change the ECS_NUMBER_OF_RX_SUBINDX_INCL_SUB0 for 3 to 4.

Code Block
languagecpp
#define ECS_NUMBER_OF_RX_SUBINDX_INCL_SUB0  4

Hint:

The slave application allways needs to decide if  the requested PDO data from EtherCAT master is possbil or is not possible.

For example, if If the slave has plugable input and output hardware, the application need to check what is connectd. If the slave has only connected input hardware and in the EtherCAT master project is choosen output hardware, than the EtherCAT slave can handle only input data and no output data.

...

Hilscher NETX90 RE ECS V5.2.0.xml

5. TwinCAT

Copy the new ESI file to the TwinCAT ESI file folder. In the new project now activate PDO assignment.

Image Added

under Stuatup the new PDO 1602 can be seen.

Image Added

set a braekpoint in netX Studio and click on relaod of TwinCAT

Image Added

Image Added

6. ESI Change for MDP