Programming - Programmable Logic controllers

Figure shows a basic counting circuit. Each time there is a transition from 0 to 1 at input In 1, the counter is reset. When there is an input to In 2 and a transition from 0 to 1, the counter starts counting. If the counter is set for, say, 10 pulses, then when 10 pulse inputs, that is, 10 transitions from 0 to 1, have been received at In 2, the counter’s contacts will close and there will be an output from Out 1. If at any time during the counting there is an input to In 1, the counter will be reset, start all over again, and count for 10 pulses.

Figure shows how the preceding program and its program instruction list would appear with a Mitsubishi PLC and a CTU counter. The reset and counting elements are combined in a single box spanning the two rungs. You can consider the rectangle to enclose the two counter ( ) outputs in Figure. The count value is set by a K program instruction.

Figure shows the same program with a Siemens PLC. With this ladder program, the counter is considered a delay element in the output line The counter is reset by an input to I0.1 and counts the pulses into input I0.0. The CU indicates that it is a up-count counter; a CD indicates a down-count counter. The counter set value is indicated by the LKC number. Figure illustrates the program for a Toshiba PLC.

Figures show the program for Allen-Bradley with up-count and down-count counters. The following are terms associated with such counters:

  • The preset value (PRE) is the count value that the counter must accumulate before the counter output is 1.
  • The accumulated value (ACC) is the accumulated number of 0 to 1 transitions of the counter rung. The count-up (CU) enable bit is 1 when the input logic makes the up counter rung 1 and 0 when the rung is 0. The count-down (CD) enable bit is 1 when the input logic makes the down-counter rung 1 and 0 when the rung is 0.
  • The done (DN) bit is 1 for both counters when the ACC value is equal to or greater than the PRE value and 0 when it is less.
  • The count-up overflow (OV) bit is 1 when the up-counter increments above the maximum positive value.
  • The count-down underflow (UN) bit is 1 when the counter decrements below the maximum negative value.
  • Reset (RES) returns counter accumulator values to zero. As long as RES is 1, ACC and all output bits are held at 0. When RES is 0, the counter is able to start counting.

To ensure that the input pulses to a counter input are short duration, the ladder program shown in Figure can be used. When there is an input to In 1, the internal relay IR 1 is activated; when the next rung is scanned a short while later, internal relay IR 2 is activated. When IR 2 is activated it switches off the input to IR 1. Thus IR 1 gives only a short duration pulse, which is then used as the input to a counter.

Counter Application

As an illustration of the use that can be made of a counter, consider the problem of items passing along a conveyor belt. The passage of an item past a particular point is registered by the interruption of a light beam to a photoelectric cell, and after a set number there is to be a signal sent informing that the set count has been reached and the conveyor stopped. Figure shows the basic elements of a Siemens program that could be used.

A reset signal causes the counter to reset and start counting again. The set signal is used to make the counter active. Figure shows the basic elements of the comparable Allen-Bradley program. When the count reaches the preset value, the done bit is set to 1, and so O:013/01 occurs, the corresponding contacts are opened, and the conveyor stopped.

As a further illustration of the use of a counter, consider the problem of the control of a machine that is required to direct six tins along one path for packaging in a box and then 12 tins along another path for packaging in another box . A deflector plate might be controlled by a photocell sensor that gives an output every time a tin passes it.

Thus the number of pulses from the sensor has to be counted and used to control the deflector. Figure shows the ladder program that could be used, with Mitsubishi notation.

When there is a pulse input to X400, both the counters are reset. The input to X400 could be the push-button switch used to start the conveyor moving. The input that is counted is X401.

This might be an input from a photocell sensor that detects the presence of tins passing along the conveyor. C460 starts counting after X400 is momentarily closed. When C460 has counted six items, it closes its contacts and so gives an output at Y430. This might be a solenoid that is used to activate a deflector to deflect items into one box or another. Thus the deflector might be in such a position that the first six tins passing along the conveyor are deflected into the six-pack box; then the deflector plate is moved to allow tins to pass to the 12-pack box. When C460 stops counting, it closes its contacts and so allows C461 to start counting. C461 counts for 12 pulses to X401 and then closes its contacts. This results in both counters being reset, and the entire process can repeat itself.

Counters can be used to ensure that a particular part of a sequence is repeated a known number of times. This is illustrated by the following program which is designed to enable a three-cylinder, double solenoid-controlled arrangement (Figure) to give the sequence Aþ, A–, Aþ, A–, Aþ, A–, Bþ, Cþ, B–, C–. The Aþ, A– sequence is repeated three times before Bþ, Cþ, B–, C– occur. We can use a counter to enable this repetition.

Figure shows a possible program. The counter only allows Bþ to occur after it has received three inputs corresponding to three a– signals.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Programmable Logic controllers Topics