Detect counting direction
The terminal can be parameterized as follows via index 0x80n1:1C "Direction inversion hysteresis":
- Detect counting direction: positive direction of rotation is output as "0", negative direction of rotation as "1" in the process data via index 0x60n2:13 "Direction inversion detected".
or
- Detect reversion of rotation: If reversing the rotation direction is detected, this is output in the process data via index 0x60n2:13 "Direction inversion detected". This function can also be used for standstill monitoring.
Detect counting direction
- Setting the hysteresis, via index 0x80n1:1C "Direction inversion hysteresis" = 0
- To detect the counting direction, the position value of the last PLC cycle (pos 1) is subtracted from the position value of the current PLC cycle (pos 2).
- The result is output during the next PLC cycle via index 0x60n2:13 "Direction inversion detected". A positive result is interpreted as a positive direction of rotation (0x60n2:13 "Direction inversion detected" = 0), a negative result as a negative direction of rotation (0x60n2:13 "Direction inversion detected" = 1).
0x80n1:1C "Direction inversion hysteresis" = 0 | ||
---|---|---|
Change in position | Direction of rotation | 0x60n2:13 "Direction inversion detected" |
pos 2 - pos 1 > 0 | Positive direction of rotation (CW) | 0 |
pos 2 - pos 1 < 0 | Negative direction of rotation (CCW) | 1 |
pos 2 - pos 1 = 0 | No change of direction of rotation | No state change |
Counter overflow | No change of direction of rotation | No state change |
Counter underflow | No change of direction of rotation | No state change |
- When the terminal is started up, a positive direction of rotation is assumed in the first PLC cycle (0x60n2:13 "Direction inversion detected" = 0), since a second position value is initially missing for the calculation.
- If an overflow (0x60n0:05 "Counter overflow") or underflow (0x60n0:04 "Counter underflow") of the counter value is detected, the result is corrected internally for the next PLC cycle, see figure (A) below.
- If the counter value is changed externally via the C track or the Latch extern input and this leads to a negative position jump, this is indicated via process data 0x60n2:13 "Direction inversion detected", see figure (B) below.
- If reversion of rotation (index 0x80n0:0E “Reversion of rotation" = TRUE) is activated, the logic of the direction of rotation detection also changes.
Detect reversion of rotation
- Input of the hysteresis in number of increments, via index 0x80n1:1C "Direction inversion hysteresis". A value greater than 0 must be selected.
- If a direction inversion is detected, an internal counter evaluates the edges detected directly one after the other for each direction of rotation and compares them with the number entered in index 0x80n1:1C.
- If the counter value exceeds the value entered in index 0x80n1:1C, the bit in index 0x60n2:13 "Direction inversion detected" is set during the next PLC cycle. The bit remains active for one cycle only.
- The bit remains active if a further direction inversion is detected within the next cycle.
- The hysteresis is considered separately for each PLC cycle, so the counter is restarted for each cycle. There is no monitoring across PLC cycles.
- If counting direction reversing (index 0x80n0:0E "Reversion of rotation" = TRUE) is activated, the logic of the direction of rotation detection also changes.
- If several changes of direction occur within one PLC cycle, the display only indicates that at least one change of direction has been detected.
Standstill monitoring
Detection of direction inversion can also be used for standstill monitoring. If an almost constant counter value is expected, the hysteresis (index 0x80n1:1C) can be used to monitor whether the value is within the window. A slight jitter of the counter value is therefore still accepted as a permissible value. If this value is exceeded, bit 0x60n2:13 "Direction inversion detected" is set during the next PLC cycle.
- If the direction changes again within the hysteresis [number of increments] specified in index 0x80n1:1C, no change of direction is indicated (standstill). See figure (A) below.
- If the hysteresis [number of increments] specified in index 0x80n1:1C is exceeded after a change of direction, the change of direction is indicated in the next cycle by setting the "Direction inversion detected" bit in index 0x60n2:13. See figure (B) below.
Drifting of the counter value Reliable detection of a drifting counter value can only be guaranteed if the value in index 0x80n1:1C "Direction inversion hysteresis" is "1". Or additional monitoring of the counter value in the PLC. |