Save counter value
The latch function enables the current counter value to be stored in separate process data, independent of the cycle time. The input “Gate” 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
Process data “Enable latch extern on positive/negative edge” - Gate input : positive/negative edge at the input “Gate”
Process data “Enable latch extern 2 on positive/negative edge”
- Zero pulse C input: via zero pulse C
Process data “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 (0x60n0:12), only the command that is set first is accepted by the terminal.
|
Save the 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:
- Process data “Enable latch extern on positive edge” (0x70n0:02) = TRUE
At the first external latch pulse with positive edge, the current counter value is stored in the process data “Latch value” (0x60n0:12). - Process data “Enable latch extern on negative edge” (0x70n0:04) = TRUE
At the first external latch pulse with negative edge the current counter value is stored in the process data “Latch value” (0x60n0:12). - Simultaneous activation of the bits in the process data “Enable latch extern on positive edge” (0x70n0:02) and “Enable latch extern on negative edge” (0x70n0:04)
The current counter value is stored in the process data “Latch value” (0x60n0:12), 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 effect on the latch value in the process data “Enable latch extern on positive edge” (0x70n0:02) and “Enable latch extern on negative edge” (0x70n0:04) when the bit in the process data “Latch value” (0x60n0:12) is set.
Only when the bit in the process data “Latch extern valid” (0x60n0:02) is set to FALSE can a new counter value be written to the latch input in the process data “Latch value” (0x60n0:12) - “Enable continuous latch extern” Index 0x80n0:22 = TRUE
The counter value is written to the process data “Latch value” (0x60n0:12) each time a configured edge occurs at the “Latch extern” input.
There is no need to reactivate the process data “Enable latch extern on positive edge” (0x70n0:02) and “Enable latch extern on negative edge” (0x70n0:04). - Saving of the count value in the process data “Latch value” (0x60n0:12) is confirmed by the bit in the process data “Latch extern valid” (0x60n0:02).
- The status of the “Latch extern” input can be monitored using the process data “Status of extern latch” (0x60n2:14).
![]() | Simultaneous activation of “Enable continuous latch extern” and “Enable latch C” When using the process data “Enable latch extern on positive/negative edge” (0x70n0:02/0x70n0:04) simultaneously while activating 0x80n0:22 “Enable continuous latch extern,” with the process data “Enable latch C” (0x70n0:01)
|
Save the counter value via a positive/negative edge on the “Gate” input (Enable latch extern 2 on positive/negative edge)
The “Gate” 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 0x80n0:04) to “0 – Disable gate” in order to be able to use the “Latch extern 2” input without locking the counter value after the latch event. |
- The counter value at the “Latch extern 2” input can be saved via:
- Process data “Enable latch extern 2 on positive edge” (0x70n0:0C) = TRUE
At the first external pulse with positive edge at the “Gate” input, the current counter value is stored in the process data “Latch value 2” (0x60n0:22). - Process data “Enable latch extern 2 on negative edge“ (0x70n0:0D) = TRUE
At the first external pulse with negative edge at the “Gate” input, the current counter value is stored in the process data “Latch value 2” (0x60n0:22). - Simultaneous activation of the bits in the process data “Enable latch extern 2 on positive edge” (0x70n0:0C) and “Enable latch extern 2 on negative edge” (0x70n0:0D)
When the first pulse is received at the “Gate” input–regardless of the polarity of the edge–the current counter value is stored in the process data “Latch value 2” (0x60n0:22). - 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” input have no effect on the latch value in the process data “Latch value 2” (0x60n0:22) when the bit in the process data “Enable latch extern 2 on positive edge” (0x70n0:0C) or “Enable latch extern 2 on negative edge” (0x70n0:0D) is set.
Only when the bit in the process data “Latch extern 2 valid” (0x60n2:12) is FALSE can a new counter value be written to the “Gate” input in the process data “Latch value 2” (0x60n0:22). - “Enable continuous latch extern 2” Index 0x80n0:23 = TRUE
The counter value is written to the process data field “Latch value 2” (0x60n2:22) each time a configured edge is detected at the “Gate” input.
There is no need to reactivate the bits in the process data “Enable latch extern 2 on positive edge” (0x70n0:0C) or “Enable latch extern 2 on negative edge” (0x70n0:0D). - The status of the input “Gate” can be recorded via the process data “Status of input gate” (0x60n0:0C).
- Saving of the counter value in the process data “Latch value 2” (0x60n0:22) is confirmed by the bit in the process data “Latch extern 2 valid” (0x60n2:12).
![]() | Simultaneous use of Gate and Latch extern 2 When using the index 0x80n0:04 “Gate polarity” (1 = “Enable pos. gate”) and simultaneous activation of the output process data “Enable latch extern 2 on positive edge” (0x70n0:0C), a positive edge on the “Gate” input first stores the current counter value in the input process data “Latch value 2” (0x60n0:22). After that, the counter value is locked. The same applies to the use of index 0x80n0:04 “Gate polarity” (2 = “Enable neg. gate”) and the simultaneous activation of the output process data “Enable latch extern 2 on negative edge” (0x70n0:0D) when a negative edge occurs at the “Gate” 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” (0x60n0:12).
- The function is activated by setting the bit in process data “Enable latch C” (0x70n0:01) to TRUE.
- The current counter value is saved in the process data “Latch value” (0x60n0:12) with the next zero pulse at input C. The subsequent pulses have no influence on the latch value.
- The bit in process data “Latch C valid” (0x60n0:01) is set to TRUE.
- After reactivating the process data “Enable latch C” (0x70n0:01) a new counter value cannot be written to the Latch input until the values of the “Enable latch C” bit (0x70n0:01) and the “Latch C valid” bit (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 the index 0x80n0:04 “Gate polarity” (“Disable gate” = 0).
Depending on the activation of the indices, the counter value may be stored via a positive or negative 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. |
Exemplary workpiece measurement sequence
- Process data “Enable latch extern on positive edge” (0x70n0:02) = TRUE:
When the first pulse with a positive edge is received at the “Latch extern” input, the current counter value is stored in the process data “Latch value” (0x60n0:12). - The count value is stored in the process data “Latch value” (0x60n0:12) via the bit in the process data “Latch extern valid” (0x60n0:02).
- Process data “Enable latch extern 2 on negative edge” (0x70n0:0D) = TRUE:
At the first external pulse with negative edge at the “Gate” input the current counter value is stored in the process data “Latch value 2” (0x60n0:22). - Saving of the counter value in the process data “Latch value 2” (0x60n0:22) is confirmed by the bit in the process data “Latch extern 2 valid” (0x60n2:12).
- The end of the measurement is confirmed by the two set bits in the process data “Latch extern valid” (0x60n0:02) and “Latch extern 2 valid” (0x60n2:12).
- 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 the process data “Enable latch extern on positive edge” (0x70n0:02) and “Enable latch extern 2 on negative edge” (0x70n0:0D) have been deactivated.
