@V_A one additional info, when you use in the PLC task the TASK_EXTERNAL_EVENT, the external event need to be added in the scheduler as well, than you will get each EtherCAT cycle a new value. But keep in mind the PLC task is now coupled to the external event, when this doesn't run, the PLC task doesn't run too.
What to do is explained in the following How-To
https://developer.community.boschrexroth.com/t5/Store-and-How-to/CODESYS-Softmotion-How-to-configure-ctrlX-CORE-and-Drives/ba-p/56123
... View more