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:

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.

Save counter value 1:

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.

  • The counter value is stored in the "Latch value" (index 0x60n0:12) at the next occurring event and confirmed with the corresponding bit.
  • All other activated events are ignored.
  • The counter value storage cannot be reactivated until all activated commands for latching the value have been deactivated. This also applies if they were activated after confirmation by the occurring event.

Save counter value via a positive/negative edge at the Latch input (Enable latch extern on positive/negative edge)

Save counter value 2:

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"

  • Only the first event, either pos./neg. edge at the Latch extern input or the zero pulse C, is written to index 0x60n0:12 "Latch value".
  • Saving of the counter value is confirmed by index 0x60n0:02 "Latch extern valid" or index 0x60n01 "Latch C valid".
  • All further edges at the Latch extern input are ignored.
  • The counter value storage cannot be reactivated until all activated commands for latching the value have been deactivated.

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.

Save counter value 3:

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.

Save counter value 4:

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).

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.

Save counter value 5:

"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)