Detection of task run times for further calculations in the PLC
Question:
How can the run time of the current task be detected?
Answer:
1. In the control configuration the system_flags are to be added (see screenshot DDS): SYSTEM_wTaskInterval AT %IW151.7: WORD; (*Interval of current task (0.25 ms) *) [CHANNEL (I)]
2. Call the variable 'SYSTEM_wTaskInterval' in the corresponding task and divide by four (1 ms corresponds to 4 * 0.25 ms).
The resulting variable corresponds to the task time in ms. It can be used for further calculations.