Latching the counter value

In incremental encoder mode, the counter value can be latched and thus the current value can be entered in the process data. Input 3 is used as a latch input.

To enable the function, the variable Enable latch extern on positive edge must be set to True. On a high level at input 3, the current counter value is entered into the variable Latch Value. You can monitor the validity of the variable. As soon as the latch value is entered, the variable Latch extern valid is also set to True.

Proceed as follows:

Latching the counter value 1:
1. Set the variable Enable latch extern on positive edge to True to enable the latch function.
2. Monitor the status of the latch input with the variable Status of extern latch.
3. On a high level at input 3, the current counter value is entered into the variable Latch Value.
4. Monitor the validity of the latch value via the variable Latch extern valid. Once the latch value has been written, the variable is also set to True.
To execute a latch again, the variable Enable latch extern on positive edge must receive a high level again.