RES — Reset
structure
RES
Clears the accumulator and status bits of a TIMER or COUNTER tag back to zero.
Operands
| Name | Type |
|---|---|
structure | TIMER | COUNTER |
How It Works
- Rung goes true →
.ACCis cleared to0and every status bit on the structure (.EN,.TT,.DN,.CU,.CD,.OV,.UNas applicable) is cleared to0. .PREis not touched — the preset survives a reset.- Rung goes false →
RESdoes nothing.
Example — Clear a Counter
XIC(Button)CTU(PartsCount);XIC(ResetCount)RES(PartsCount)
Each rising edge on Button increments PartsCount.ACC. Pressing ResetCount clears the accumulator and PartsCount.DN.
When to Use
- Clearing a retentive timer (
RTO) — it is the only way to drop.ACCback to zero. - Resetting a counter (
CTU,CTD) — counters are retentive across rung transitions.
When Not to Use
- A non-retentive timer (
TON,TOF) already resets when its rung drops. CallingRESon it is redundant.
Common Mistakes
- Leaving the
RESrung always-true — that holds the structure at zero forever and the timer or counter never runs.
Related
- Timers overview
- Counters overview
- RTO — retentive timer that requires
RES - CTU, CTD — retentive counters