Transferring edges between tasks

Question:
How can an edge be transferred between two tasks with different runtimes?

Answer:
The function blocks R_TRIG and F_TRIG can be used for detecting the edges of a binary signal. If an edged is detected at the input of one of these function blocks its output is set to TRUE for one processing cycle. This output signal can only be used reliably in that task in which this function block is called up. If the output signal is to be used in a slower task, too, it may happen that the output signal is reset by a faster task before the slower task is started and the edge is detected there.

Solution:
If the function blocks R_TRIG or F_TRIG detect an edge the global auxiliary variable (e. g. g_bTranferEdgeInformation, see at the bottom) is set to TRUE. In the slower task this global variable is evaluated and reset to FALSE. As a result, the edge in the slower task is detected reliably, too.

When this solution is applied it must be ensured that the time between the two edges is not shorter than the interval time of the slower task.

URL for linking this AKB article: https://www.lenze.com/en-de/go/akb/200701265/1/
Kontaktformular