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:

Index 0x80n0:22Enable continuous latch extern” and 0x80n0:23Enable 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 (0x60n0:12), only the command that is set first is accepted by the terminal.

  • The counter value is stored in the process data “Latch value” (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 the 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 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)

  • only the first event, either pos./neg. edge at the “Latch extern” input or the zero pulse C, is written to the process data “Latch value” (0x60n0:12).
  • saving of the count value is confirmed in each case via the process data “Latch extern valid” (0x60n0:02) or “Latch C valid” (0x60n0:01).
  • 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 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.

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 locking the counter value after the latch event.

Save counter value 4:

Simultaneous use of Gate and Latch extern 2

When using the index 0x80n0:04Gate 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).

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:04Gate polarity” (“Disable gate” = 0).

Depending on the activation of the indices, the counter value may be stored via a positive or negative 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:22Enable continuous latch extern” to FALSE for the workpiece measurement.

Exemplary workpiece measurement sequence