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 zero pulse C (Enable latch C)
Index 0x8000:22 "Enable continuous latch extern" and 0x8000: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 0x7000: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 0x6000:12 "Latch value". - Index 0x7000: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 0x6000:12 "Latch value". - Simultaneous activation of 0x7000:02 and 0x7000:04
On the first external Latch pulse, regardless of the polarity of the edge, the current counter value is stored in index 0x6000:12 "Latch value". - Specification whether it is necessary to reactivate the command to save the counter value via:
- "Enable continuous latch extern" Index 0x8000:22 = FALSE
The following pulses at the latch extern input have no influence on the latch value in Index 0x6000:12 "Latch value" if the bit in Index 0x7000:02 or 0x7000:04 is set.
Only when index 0x6000:02 "Latch extern valid" is FALSE, a new counter value can be written to the latch input in index 0x60n0:12 "Latch value" - "Enable continuous latch extern" Index 0x8000:22 = TRUE
The counter value is written to index 0x60n00:12 "Latch value" with each parameterized edge at the latch extern input.
A new activation of index 0x7000:02 or 0x7000:04 is omitted. - Saving of the counter value in index 0x6000:12 "Latch value" is confirmed via the "Latch extern valid" bit (index 0x6000:02).
- The status of the Latch extern input can be monitored via index 0x6002:14 "Status of extern latch".
![]() | Simultaneous activation of "Enable continuous latch extern" and "Enable latch C" When using 0x7000:02/0x7000:04 "Enable latch extern on positive/negative edge", by activating 0x8000:22 "Enable continuous latch extern" simultaneously with 0x7000: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 Gate/Latch input may be used as a second latch input (Latch extern 2). To do this, the gate should be disabled.
![]() | Deactivation of the gate Set the "Gate polarity" bit (index 0x8000: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 0x7000:0C "Enable latch extern 2 on positive edge" = TRUE
At the first external latch pulse with positive edge at the Gate/Latch input the current counter value is stored in index 0x6000:22 "Latch value 2". - Index 0x7000:0D "Enable latch extern 2 on negative edge" = TRUE
At the first external pulse with negative edge at the Gate/Latch input the current counter value is stored in index 0x6000:22 "Latch value 2". - Simultaneous activation of 0x7000:0C and 0x7000:0D
On the first pulse at the Gate/Latch input, regardless of the polarity of the edge, the current counter value is stored in index 0x6000:22 "Latch value 2". - Specification whether it is necessary to reactivate the command to save the counter value via:
- "Enable continuous latch extern 2" Index 0x8000:23 = FALSE
The following pulses at the Gate/Latch input have no influence on the Latch value in index 0x6000:22 "Latch value 2" if the bit in index 0x7000:0C or 0x7000:0D is set.
Only when index 0x6002:12 "Latch extern 2 valid" is FALSE, a new counter value can be written to the Gate/Latch input in index 0x6000:22 "Latch value 2". - "Enable continuous latch extern 2" index 0x8000:23 = TRUE
The counter value is written to index 0x6002:12 "Latch value 2" for each parameterized edge at the Gate/Latch input.
There is no need to reactivate Index 0x7000:0C or 0x7000:0D. - The status of the Gate/Latch input can be recorded via index 0x6000:0C "Status of input gate".
- Saving of the counter value in index 0x6000:22 "Latch value 2" is confirmed via bit 0x6002:12 "Latch extern 2 valid".
![]() | Simultaneous use of Gate und Latch extern 2 When using index 0x8000:04 "Gate polarity"(1 = "Enable pos. gate") and simultaneously activating index 0x7000:0C "Enable latch extern 2 on positive edge", the current counter value is initially stored in index 0x6000: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 0x80n00:04 "Gate polarity" (2 = "Enable neg. gate") and simultaneous activation of index 0x7000: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 disabled via index 0x8000: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 0x8000:22 "Enable continuous latch extern" to FALSE for the workpiece measurement. |
Workpiece measurement sequence (example)
- Index 0x7000:02 "Enable latch extern on positive edge" = TRUE
At the first external latch pulse with positive edge at Latch extern input the current counter value is stored in index 0x6000:12 "Latch value". - Saving of the counter value in index 0x6000:12 "Latch value" is confirmed via bit 0x6000:02 "Latch extern valid".
- Index 0x7000:0D "Enable latch extern 2 on negative edge" = TRUE:
At the first external pulse with negative edge at the Gate/Latch input the current counter value is stored in index 0x6000:22 "Latch value 2". - Saving of the counter value in index 0x6000:22 "Latch value 2" is confirmed via the "Latch extern 2 valid" bit in index 0x6002:12.
- The end of the measurement is confirmed via the two activated bits in index 0x6000:02 "Latch extern valid" and index 0x6002: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 0x7000:02 "Enable latch extern on positive edge" and 0x7000:0D "Enable latch extern 2 on negative edge" have been disabled.