AlfredoQuintero
Lifetime Supporting Member
Hello TwinCAT and CODESYS experts: kolyur, AustralIan, busarider29, et. al.
I will be once again very glad to get your expert advice on this one issue.
I have to develop a PLC program for a somehow sophisticated but very straight forward EtherCAT device: all the control and monitoring of the device takes place through the process data objects. No problem up to this point; I get the comms and so on. The ESI file describes in exhaustive detail the mapping of all the variables in the EtherCAT device. So I created in the PLC program user data types that mirror the description of the PDO structures, and one can copy paste the UDTs from CODESYS to TwinCAT and viceversa.
In CODESYS I can declare a variable of the user defined type and by means of the AT qualifier in the declaration, and by confirming the actual memory assignment for the EtherCAT device in one simple assignment all the variables that are defined in the user data type get automatically assigned to the correct offsets in the IO memory, in one line of code!
My question is whether it is possible to do the same in TwinCAT an based on the result of my attempts, it seems it is not possible, as TwinCAT only allows (or seems only allow, would love to be proven wrong here) basic data types like BOOL or INT to be linked as the TwinCAT program detects the different variables described in the ESI file.
In case the above is the cause for not being able to do one IO-to-PLC-variable link in TwinCAT, I wonder whether it would be possible to develop and ESI file that would describe a user defined data type and then the entries in the PDO would not be a collection of the different BOOL, INT, DINT, etc, but the defined user data types. I have never seen such an ESI file (there may be) but I am hypothesizing here that if the ESI file entry was say for the Tx PDO one single variable of the same SIZEOF as the user data type in the TwinCAT UDT definitions, then it may allow to assign just one variable. This would be very useful for the user-friendliness of this EtherCAT device, as I can foresee a use case in which one machine may require several of these devices.
Of course normally nobody should modify ESI files other than the manufacturer of the device, but this device is not yet released and we are developing this firmware, hence we are in this unique position in which we still can change the ESI file. Long e-mail, sorry about that, but thanks for reading down to this point.
I will be once again very glad to get your expert advice on this one issue.
I have to develop a PLC program for a somehow sophisticated but very straight forward EtherCAT device: all the control and monitoring of the device takes place through the process data objects. No problem up to this point; I get the comms and so on. The ESI file describes in exhaustive detail the mapping of all the variables in the EtherCAT device. So I created in the PLC program user data types that mirror the description of the PDO structures, and one can copy paste the UDTs from CODESYS to TwinCAT and viceversa.
In CODESYS I can declare a variable of the user defined type and by means of the AT qualifier in the declaration, and by confirming the actual memory assignment for the EtherCAT device in one simple assignment all the variables that are defined in the user data type get automatically assigned to the correct offsets in the IO memory, in one line of code!
My question is whether it is possible to do the same in TwinCAT an based on the result of my attempts, it seems it is not possible, as TwinCAT only allows (or seems only allow, would love to be proven wrong here) basic data types like BOOL or INT to be linked as the TwinCAT program detects the different variables described in the ESI file.
In case the above is the cause for not being able to do one IO-to-PLC-variable link in TwinCAT, I wonder whether it would be possible to develop and ESI file that would describe a user defined data type and then the entries in the PDO would not be a collection of the different BOOL, INT, DINT, etc, but the defined user data types. I have never seen such an ESI file (there may be) but I am hypothesizing here that if the ESI file entry was say for the Tx PDO one single variable of the same SIZEOF as the user data type in the TwinCAT UDT definitions, then it may allow to assign just one variable. This would be very useful for the user-friendliness of this EtherCAT device, as I can foresee a use case in which one machine may require several of these devices.
Of course normally nobody should modify ESI files other than the manufacturer of the device, but this device is not yet released and we are developing this firmware, hence we are in this unique position in which we still can change the ESI file. Long e-mail, sorry about that, but thanks for reading down to this point.