I am trying to read the InfoData.State for each terminal on a EtherCAT device. I would like to read it directly from the I/O without linking it to a GVL variable.
I have enabled the ADS Server for the device, and I am able to read inputs/outputs just fine. However I am unable to read the InfoData State using the same method as with the other values. The following image displays the structure I would like to access.
Structure
In this case I would like to read all Term.InfoData.State on the device. Channel 1 input is fine to read using the port and amsNetId and the name.
Channel 1 input
However when I try the same method but with the port mentioned in InfoData.State I get DeviceSymbolNotFound . I am using the symbol name ").Term 12 (EK1100).InfoData.State". The one that is successful for the inputs are ").Term 12 (EK1100).Term 13 (EL1008).SM_0.Channel_1_Input" (For term 13 but should be the same principle)
State Since there is no SymbolInfo field on the state I suppose a symbol is not being created.
My question is is it not inherently available in the same way as the inputs, is there a setting I have missed or do I just use the wrong port/amsNetId for it.
I am trying to read the InfoData.State for each terminal on a EtherCAT device. I would like to read it directly from the I/O without linking it to a GVL variable.
I have enabled the ADS Server for the device, and I am able to read inputs/outputs just fine. However I am unable to read the InfoData State using the same method as with the other values. The following image displays the structure I would like to access.
Structure
In this case I would like to read all Term.InfoData.State on the device. Channel 1 input is fine to read using the port and amsNetId and the name.
Channel 1 input
However when I try the same method but with the port mentioned in InfoData.State I get DeviceSymbolNotFound . I am using the symbol name ").Term 12 (EK1100).InfoData.State". The one that is successful for the inputs are ").Term 12 (EK1100).Term 13 (EL1008).SM_0.Channel_1_Input" (For term 13 but should be the same principle)
State Since there is no SymbolInfo field on the state I suppose a symbol is not being created.
My question is is it not inherently available in the same way as the inputs, is there a setting I have missed or do I just use the wrong port/amsNetId for it.
Share Improve this question asked Nov 20, 2024 at 11:51 JonaskhJonaskh 213 bronze badges1 Answer
Reset to default 0Use an ADS client that is connected to the EtherCAT masters AmsNetId and Port number 65535.
Prepare a byte buffer[] that has a length that is equal to 2*ConfiguredSlaveCount. (2 is the size of ST_EcSlaveState).
If you don't know your configured slave count you can read it as an uint from the same ADS client at index group 0x6 subIndex 0x0.
Do a Client.Read operation supplying this buffer to index group 0x9 and subIndex 0x0. Your buffer will be filled with data that describes an ST_EcSlaveState for each of your configured slaves. A description of the struct can be found here: https://infosys.beckhoff/english.php?content=../content/1033/tcplclib_tc2_ethercat/57122443.html&id=