IEC_COUNTEREUCOUNTERUSIEC_COUNTERCOUNTER Counter

Also called: counter, IEC_COUNTER, counter structure

A counter's memory: one variable per counter.

What it does

You declare a counter variable (C1, Parts…) and give it to a CTU, CTD or CTUD instruction. The instruction decides whether it counts up, down or both; the variable holds the preset, the current value and the status bits.

When to use it

Counting parts, cycles or presses, then acting when the preset is reached.

Instance members

Each instance has its own memory, readable anywhere in the program, for example C1.Q / C1.DN.Each instance has its own memory, readable anywhere in the program, for example C1.Q.Each instance has its own memory, readable anywhere in the program, for example C1.DN.

European mnemonicAmerican mnemonicNameData typeAccessIn
.CU.CUCount upBOOLReadCTU, CTUD
.R—ResetBOOLReadCTU, CTUD
.PV.PREPresetDINTRead and writeCTU, CTD, CTUD
.Q.DNDoneBOOLReadCTU, CTD
.CV.ACCAccumulator: current valueDINTRead and writeCTU, CTD, CTUD
—.OVOverflowBOOLReadCTU, CTD
—.UNUnderflowBOOLReadCTU, CTD
.CD.CDCount downBOOLReadCTD, CTUD
.LD—LoadBOOLReadCTD, CTUD
.QU.DNPreset reached (done)BOOLReadCTD, CTUD, CTU
.QD—Zero reachedBOOLReadCTUD
MnemonicNameData typeAccessIn
.CUCount upBOOLReadCTU, CTUD
.RResetBOOLReadCTU, CTUD
.PVPresetDINTRead and writeCTU, CTD, CTUD
.QDoneBOOLReadCTU, CTD
.CVAccumulator: current valueDINTRead and writeCTU, CTD, CTUD
.CDCount downBOOLReadCTD, CTUD
.LDLoadBOOLReadCTD, CTUD
.QUPreset reached (done)BOOLReadCTD, CTUD
.QDZero reachedBOOLReadCTUD
MnemonicNameData typeAccessIn
.CUCount upBOOLReadCTU
.PREPresetDINTRead and writeCTU, CTD
.DNDoneBOOLReadCTU, CTD
.ACCAccumulator: current valueDINTRead and writeCTU, CTD
.OVOverflowBOOLReadCTU, CTD
.UNUnderflowBOOLReadCTU, CTD
.CDCount downBOOLReadCTD

Behaviour in detail

European (IEC) and American styles

European: IEC_COUNTER type, members PV, CV, CU, CD, Q / QU / QD.

American: COUNTER type, members .PRE, .ACC (DINT), .CU, .CD, .DN, .OV, .UN.