Save counter value
The latch function enables the current counter value to be stored in separate process data, independent of the cycle time. The Gate/Latch input can be parameterized as a second external latch input with separate process data. The latch function can be triggered as follows:
- Latch input: positive/negative edge at the Latch input (Enable latch extern on positive/negative edge)
- Gate/Latch input: positive/negative edge at the Gate/Latch input (Enable latch extern 2 on positive/negative edge)
- Zero pulse C input: via the zero pulse C (Enable latch C)
Index 0x80n0:22 "Enable continuous latch extern" and 0x80n0:23 "Enable continuous latch extern 2" can be used to parameterize whether the function is executed at every parameterized external edge at the Latch input or only once after every activation.
A workpiece measurement can be realized by using two independent Latch inputs.
![]() | Multiple activation of the latch function If several commands are activated simultaneously to save the counter value in the "Latch value" process data (index 0x60n0:12), only the command that is set first is accepted by the terminal.
|
Save counter value via a positive/negative edge at the Latch input (Enable latch extern on positive/negative edge)
- The counter value at the Latch extern input can be saved via:
- Index 0x70n0:02 "Enable latch extern on positive edge" = TRUE
At the first external latch pulse with positive edge the current counter value is stored in index 0x60n0:12 "Latch value". - Index 0x70n0:04 "Enable latch extern on negative edge" = TRUE
At the first external latch pulse with negative edge the current counter value is stored in index 0x60n0:12 "Latch value". - Simultaneous activation of 0x70n0:02 and 0x70n0:04
The current counter value is stored in index 0x60n0:12 "Latch value", at the first external latch pulse, independent of the edge polarity. - Specification whether it is necessary to reactivate the command to save the counter value via:
- "Enable continuous latch extern" Index 0x80n0:22 = FALSE
The following pulses at the Latch extern input have no influence on the latch value in index 0x60n0:12 "Latch value" when the bit in index 0x70n0:02 or 0x70n0:04 is set.
A new counter value can only be written to the Latch input in index 0x60n0:12 "Latch value" if index 0x60n0:02 "Latch extern valid" is FALSE - "Enable continuous latch extern" Index 0x80n0:22 = TRUE
The counter value is written to index 0x60n0:12 "Latch value" at every parameterized edge at the Latch extern input.
There is no need to reactivate index 0x70n0:02 or 0x70n0:04. - Saving of the counter value in index 0x60n0:12 "Latch value" is confirmed via the "Latch extern valid" bit (index 0x60n0:02).
- The status of the Latch extern input can be monitored via index 0x60n2:14 "Status of extern latch".
![]() | Simultaneous activation of "Enable continuous latch extern" and "Enable latch C" When using 0x70n0:02/0x70n0:04 "Enable latch extern on positive/negative edge", by activating 0x80n0:22 "Enable continuous latch extern" simultaneously with 0x70n0:01 "Enable latch C"
|
Save counter value via a positive/negative edge at the Gate/Latch input (Enable latch extern 2 on positive/negative edge)
The terminal offers the option of using the Gate/Latch input as a second Latch input (Latch extern 2). To do this, the gate should be deactivated.
![]() | Deactivation of the gate Set the "Gate polarity" bit (index 0x80n0:04) to "0 - Disable gate" in order to be able to use the Latch extern 2 input without disabling the counter value after the latch event. |
- The counter value at the Latch extern 2 input can be saved via:
- Index 0x70n0:0C "Enable latch extern 2 on positive edge" = TRUE
The current counter value is stored in index 0x60n0:22 "Latch value 2" at the first external pulse with positive edge at the Gate/Latch input. - Index 0x70n0:0D "Enable latch extern 2 on negative edge" = TRUE
The current counter value is stored in index 0x60n0:22 "Latch value 2" at the first external pulse with negative edge at the Gate/Latch input. - Simultaneous activation of 0x70n0:0C and 0x70n0:0D
The current counter value is stored in index 0x60n0:22 "Latch value 2" at the first pulse at the Gate/Latch input, independent of the edge polarity. - Specification whether it is necessary to reactivate the command to save the counter value via:
- "Enable continuous latch extern 2" Index 0x80n0:23 = FALSE
The following pulses at the Gate/Latch input have no influence on the latch value in index 0x60n0:22 "Latch value 2" when the bit in index 0x70n0:0C or 0x70n0:0D is set.
A new counter value can only be written to the Gate/Latch input in index 0x60n0:22 "Latch value 2" if index 0x60n2:12 "Latch extern 2 valid" is FALSE. - "Enable continuous latch extern 2" Index 0x80n0:23= TRUE
The counter value is written to index 0x60n2:12 "Latch value 2" at every parameterized edge at the Gate/Latch input.
There is no need to reactivate index 0x70n0:0C or 0x70n0:0D. - The status of the Gate/Latch input can be recorded via index 0x60n0:0C "Status of input gate".
- Saving of the counter value in index 0x60n0:22 "Latch value 2" is confirmed via bit 0x60n2:12 "Latch extern 2 valid".
![]() | Simultaneous use of Gate und Latch extern 2 When using index 0x80n0:04 "Gate polarity" (1 = "Enable pos. gate") and simultaneously activating index 0x70n0:0C "Enable latch extern 2 on positive edge", the current counter value is initially stored in index 0x60n0:22 "Latch value 2" when a positive edge is detected at the Gate/Latch input. The counter value is then blocked. The same applies to the use of index 0x80n0:04 "Gate polarity" (2 = "Enable neg. gate") and simultaneous activation of index 0x70n0:0D "Enable latch extern 2 on negative edge" at a negative edge at the Gate/Latch input. |
Save counter value via the zero pulse C input (Enable latch C)
The counter value can be stored at runtime via the process data and the zero pulse in "Latch value" (index 0x60n0:12).
- The function is activated by setting the bit in "Enable latch C" (index 0x70n0:01) to TRUE.
- The current counter value is saved in "Latch value" (Index 0x60n0:12) with the next zero pulse at input C. The subsequent pulses have no influence on the latch value.
- The "Latch C valid" bit (Index 0x60n0:01) is set to TRUE.
- After reactivating "Enable Latch C" (index 0x70n0:01) a new counter value cannot be written to the Latch input until the values of the "Enable Latch C" bit (index 0x70n0:01) and the "Latch C valid" bit (index 0x60n0:01) are FALSE.
Workpiece measurement
The two latch functions (Latch extern and Latch extern 2) can be used to measure workpieces or distances between two workpieces. To use the Latch extern 2 function, the gate should be deactivated via index 0x80n0:04 "Gate polarity" ("Disable gate" = 0).
Depending on the activation of the indices, the counter value may be stored via a rising or falling edge.
![]() | "Continuous latch" for workpiece measurement To prevent the stored value from being overwritten, it is advisable to set the setting in index 0x80n0:22 "Enable continuous latch extern" to FALSE for the workpiece measurement. |
Workpiece measurement sequence (example)
- Index 0x70n0:02 "Enable latch extern on positive edge" = TRUE:
The current counter value is stored in index 0x60n0:12 "Latch value" at the first pulse with positive edge at the Latch extern input. - Saving of the counter value in index 0x60n0:12 "Latch value" is confirmed via bit 0x60n0:02 "Latch extern valid".
- Index 0x70n0:0D "Enable latch extern 2 on negative edge" = TRUE:
the current counter value is stored in index 0x60n0:22 "Latch value 2" at the first external pulse with negative edge at the Gate/Latch input. - Saving of the counter value in index 0x60n0:22 "Latch value 2" is confirmed via the "Latch extern 2 valid" bit in index 0x60n2:12.
- The end of the measurement is confirmed via the two activated bits in index 0x60n0:02 "Latch extern valid" and index 0x60n2:12 "Latch extern 2 valid".
- The workpiece length can be calculated from the difference between the two values "Latch value" and "Latch value 2".
- A new workpiece measurement can be started after the bits in index 0x70n0:02 "Enable latch extern on positive edge" and 0x70n0:0D "Enable latch extern 2 on negative edge" have been deactivated.