I'm using the ADS-DLL C++ library in a client ADS application. I'm able to communicate with a remote TwinCAT Runtime (configuring the local ADS router with it's plc AmsNetId). I'm able to communicate with any EtherCAT device in the fieldbus using CoE protocol (knowing the EtherCAT controller AmsNetId). My problem: is there a way to get the NetId of the EtherCAT master device(s) knowing nothing about the project that is running in the runtime? Better by using the functions in the ADS-DLL library. For the typical user knowing the address of the remote plc runtime is easy, just use the scan function present in the ADS router. But knowing the AmsNetId of the EtherCAT controllers inside the plc runtime is not easy if you don't know the project configuration.

I found some solutions but they all require modifying the project application, and this is not possible.

1

There are 1 answers

0
jkimpa On

I was facing a similar issue, only difference is that I knew the ID (1) of one axis on my system. Knowing this I can connect with ADS to port 500 (the NC). There I can read Index group 0x4000 + Axis-ID, sub-index 0x00000031.

This will return a data structure that contains: "The hardware AMS address (AMS Net ID and AMS Port No) and the EtherCAT channel number (communication channel 0,1,2,3…)"

This hardware AMS adress contains the Net ID of the EtherCAT master.

I found the specification of the correct subindex to read in the Beckhoff Infosys, ADS specification of the NC: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_ads_intro/713092619.html&id=1285928777053769402