Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important information on the platform change.

ctrlXDRIVE Ethercat

Ethercat SoE: Read and write ctrlX DRIVE and/or Indradrive parameters via PLC

MauroRiboniMX
Contributor
Disclaimer

The goal is to read/write SoE parameters using standard PLC Function Blocks. All the examples in the following are suited for single axis drives, for double axis drives some slight modifications should be done. In using EtherCAT all REAL parameters are managed as scaled DINT parameters. These function blocks are working also with list parameters.

Requirements

Needed devices, apps:

  • ctrlX CORE
  • Indradrive or ctrlX DRIVE correctly connected
  • PLC and EtherCAT apps.

If you don't know how to setup the EtherCAT bus just follow SoE drive setup 

STEP1: PLC Engineering software

The first operation you need to do is to import the right library: the CXA_ETHERCATMASTER. Inside there are the SoE function blocks together with the examples, this guide is based on the use of them. Every of the following function blocks needs:

  • The address to a string variable containing the EtherCATmaster master name, usually "ethercatmaster"
  • The drive EtherCAT address: usually 1001,1002,...
  • The DriveNo: drive number if the drive is multi axis (0,1..)
  • The Parameter Idn obtained using IL_ECATSoeIdnCoding Function

ctrlXCORE ethercat library ctrlXCORE ethercat library

 

IL_ECATSoeCommand

Here an example of how you can use the IL_ECATSoeCommand FB to clear and set the encoder absolute position is shown. The two parameters are both S parameters then the function IL_ECATSoeCommand takes SOE_S_PARAM as first entry. One executed the function remains active until it goes to "Command Executed" or "Error". 

Ethercat command for ctrlXDRIVEEthercat command for ctrlXDRIVE

IL_ECATSoeRead

Here an example of how you can use the IL_ECATSoeRed FB to read a P parameter is shown. Differently from the previous FB this needs as input also the address and the size of the destination variable.

Read ethercat parameter ctrlXCORERead ethercat parameter ctrlXCORE

 

IL_ECATSoeWrite

Same as the previous function block but in the other direction. This example can be used to write the homing quota value. 

Write ethercat parameter ctrlXCOREWrite ethercat parameter ctrlXCORE

Read Strings

Codesys uses null-terminated strings, the string will then miss the null at the end. It is possible to use the IL_BufferToString function to get a properly terminated string.

Read Codesys stringRead Codesys string

You can find the example attached. Have Fun 😎

Notes

The EtherCat SoE specification is based on the SERCOS II. The structured parameter including the indexes (instance.element e.g. S-0-602.1.1) were first introduced in SERCOS III. Even IDN size changed from 2 Byte to 4 Byte and so access to this parameter is not possible via SoE.

CodeShepherd
CodeShepherd
Technical sales support from Bosch Rexroth
1 Comment
CodeShepherd
Community Moderator
Community Moderator
Must Read
Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist