Counter LD

The IEC 61131 standard offers a definition of Counters. PLC3000 integrates up and down Counters. It is necessary to define a preset value %Ci.PV, which can be set with an integer value. The current value of a counter is set to 0 when %Ci.R is activated. The current value of a counter is set to the preset value %Ci.PV, when %Ci.LD is activated. The current value of a counter is incremented each time the %Ci.CU input is activated, and decremented each time the %Ci.CD input is activated.

A counter has two outputs; %Ci.QU goes to 1 when the current counter value is equal to or higher than the preselected value %Ci.PV; %Ci.QD goes to 1 when the current counter value is equal to 0.

Generation in LD

A Counter and its preset value are defined during the declaration of variables in the Ladder code editor. For example, the counter %C1 with the preset value %C1.PV=10 is defined as:

Illustration with a Grafcet

Let’s considering the following Grafcet

Programming in LD – Transition/Transition with Crossing Bits

Initialization

Test on Receptivity

Transition Crossing

Output declaration