Using SDO, I can read the EtherCAT mappings and offsets from various registers like 0x1c12, 0x1c13, etc. When I obtain registers mapped in the PDOs and various offsets, I could technically access directly to the statusword, controlword, etc., if they are mapped. I have noticed that on IoDrvEthercatLib.ETCSlave_Diag I can find pointers to the input and output buffers. However, although the input buffer can be easily read by referring to what has been obtained from the SDOs, it is not possible to write to the output buffer, as it is overwritten in each cycle by the data from the IOMapping task. Is there a way, knowing an instance of IoDrvEthercatLib.ETCSlave_Diag, to obtain the pointer to the first data in the IOMapping? The offsets are identical to those of the PDOs, but obviously the data is a copy. For me, the cleanest thing would be to access the pointers on IOMapping, for DS402a devices to retrieve the key data and point them to internal references.
I need to know this as, having developed our own motion library, I would like to simplify the initial setup by eliminating unnecessary and nonsensical mappings that can lead users to unnecessary errors. In the current version that we have been using for years, we have to map everything manually. I would like to pass only the slave reference to the FB_init constructors and eliminate the mapping.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Im not sure if this is what you mean, but i do succesfully use the IoDrvEthercatLib.ETCSlave.InputData and IoDrvEthercatLib.ETCSlave.OutputData to read from and write to beckhoff DI and DO cards. Very convenient as you can make an FB with an VAR_IN_OUT of type IoDrvEthercatLib.ETCSlave and only have to pass the slave reference... So i am not using .ETCSlave_Diag but .ETCSlave...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for the response!
It's a path I had already considered, however, while it has always worked for me on inputs, it doesn't on outputs, because if I enable the option to update all IOs at every scan, the IO tasks overwrite each other.
However, I have found something very interesting which I am posting below.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The first is the list of IO tasks.
The second is the connector for each IO module in the IOMap.
The third is the individual input or output on the IOMap.
One of the properties of the connector is another pointer to a connector, which corresponds with the connector of the EtherCAT slave.
Through this information, it is possible to understand to which EtherCAT slave an IO connectormap corresponds.
I am attaching an FB that allows for the construction of an IO map and finding the pointer to the actual IOs in the IOMap based on the bitoffset.
Using SDO, I can read the EtherCAT mappings and offsets from various registers like 0x1c12, 0x1c13, etc. When I obtain registers mapped in the PDOs and various offsets, I could technically access directly to the statusword, controlword, etc., if they are mapped. I have noticed that on IoDrvEthercatLib.ETCSlave_Diag I can find pointers to the input and output buffers. However, although the input buffer can be easily read by referring to what has been obtained from the SDOs, it is not possible to write to the output buffer, as it is overwritten in each cycle by the data from the IOMapping task. Is there a way, knowing an instance of IoDrvEthercatLib.ETCSlave_Diag, to obtain the pointer to the first data in the IOMapping? The offsets are identical to those of the PDOs, but obviously the data is a copy. For me, the cleanest thing would be to access the pointers on IOMapping, for DS402a devices to retrieve the key data and point them to internal references.
I need to know this as, having developed our own motion library, I would like to simplify the initial setup by eliminating unnecessary and nonsensical mappings that can lead users to unnecessary errors. In the current version that we have been using for years, we have to map everything manually. I would like to pass only the slave reference to the FB_init constructors and eliminate the mapping.
Hi,
Im not sure if this is what you mean, but i do succesfully use the IoDrvEthercatLib.ETCSlave.InputData and IoDrvEthercatLib.ETCSlave.OutputData to read from and write to beckhoff DI and DO cards. Very convenient as you can make an FB with an VAR_IN_OUT of type IoDrvEthercatLib.ETCSlave and only have to pass the slave reference... So i am not using .ETCSlave_Diag but .ETCSlave...
rmaas: how do you get the reference of the slave?
Thank you for the response!
It's a path I had already considered, however, while it has always worked for me on inputs, it doesn't on outputs, because if I enable the option to update all IOs at every scan, the IO tasks overwrite each other.
However, I have found something very interesting which I am posting below.
Last edit: mondinmr 2024-02-13
The reference used is the ethercat slave name.
For example in this screenshot the reference would be: EL1809_1
I have found a very interesting solution using:
IoConfigTaskMap
IoConfigConnectorMap
IoConfigChannelMap
The first is the list of IO tasks.
The second is the connector for each IO module in the IOMap.
The third is the individual input or output on the IOMap.
One of the properties of the connector is another pointer to a connector, which corresponds with the connector of the EtherCAT slave.
Through this information, it is possible to understand to which EtherCAT slave an IO connectormap corresponds.
I am attaching an FB that allows for the construction of an IO map and finding the pointer to the actual IOs in the IOMap based on the bitoffset.
Wow, this is next level for me, very impressive!
glad you found a solution, thanks for sharing!