Siemens PLC Counters and Comparators Programming

Siemens PLC Counters and Comparators Logic

Understand and use of Siemens PLC counters and comparators Programming on PLC to control a work system and solve problems to make a control algorithm to control a system as we want.

II. EQUIPMENT:

  1. Siemens S7 300 PLC

Siemens S7 300 PLC

III. THEORY

Three types of counters commonly used:

• Up Counter
• Down Counter
• Up Down Counter
Counter is a simple function to calculate, for Up Counter counting forward 1,2,3 …

For Down Counter counts down 9,8,7, … and there is also called Up Down Counter whose function is counting forward and backward, for example 1,2,3,4,5,4,3,2, …

While the Comparator functions as an input comparison in the form of WORD, the types are as follows:

  • Equal
  • Not Equal
  • Greater Than
  • Less Than

For Equal, then if the input value is compared then the output will be active or worth 1. While Not Equal is the opposite of Equal, if the input value is compared then the output will be active or worth

1.For Greater than it must be given a standard value, if the input value exceeds the standard value then it is fulfilled and the output will be active.

For Less than the opposite of Greater than, a standard value is also given, if the input value exceeds the standard value then the output will be fulfilled

IV. DATA OF PRACTICUM RESULTS AND ANALYSIS:

The steps to make an Up Counter are as follows:

  1. Just like a timer, the function counter can be taken from the left side layout

  1. For example, we use the S_CU Up Counter

Double click it will appear

image

  1. Fill it with C0

image

  1. Add Input and Output

image

  1. Simulated I0.0 is ON

image

  1. The CV_BCD looks worth 1, and Q4.0 will be active if the count is> 0
    I0.0 is off and then on again, the counter will be 2

image

  1. To move counts to PLC variables, use MW (memory word)

For this example, use MW10

image

  1. The count value in MW10 can be used for other processes, for example as a count of the number of products that pass, interlocking, etc.

For a counter use case example, what will be exemplified is: if after 5 counts the output Q4.1 will be active

image

  1. Select the function to compare, in this case using GE_I (Greater Equal Integer) or in another sense>> for values ​​of type integer

  1. Output Q4.1 will be on if the number of calculations (MW10) is more than or equal to the setpoint, namely 5

image

  1. To reset the counter, add input to the counter function

image

  1. When the counter is reset, MW10 returns to 0 and output Q4.1 is off

Down Counter is also the same way with Up Counter, so just change to the Down Counter icon.

V. CONCLUSION

After analysis, it can be concluded as follows:

Counter (counter) has 3 basic functions that are often used, namely Counter Up (counting up), Counter Down (counting down), Counter Up Down (counting up and down). These basic functions are often used in industrial plants, for example to calculate the movement of each machine, calculate production for 1 shift etc.

Comparator has 4 functions, namely Comparator Equal (comparator of the same value), Comparator Not Equal, Comparator Greater Than (Comparator Greater Than (greater value comparison), Comparator Less Than (comparison of smaller values). These basic functions are also often used in industrial plants, for example to limit the amount of production, limit the number of actuator movements etc.

Counter and Comparator are often combined in a program’s algorithm, for example in limiting movement, first the input enters the counter to calculate its motion then the output goes into the comparator and compared to the standard set, if the standard exceeds the engine will die.

4 Likes

PLC Compare Instructions CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NE

Download

Compare Instructions CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NE.pdf (400.0 KB)