×

Subscribe to newsletter

subscribe to our weekly newsletter to get notified with latest story and article Subscribe now!




PLC BLOG | Siemens Counter Instructions
Share on Facebook Share On Twitter Share on LinkedIn Share on Whatsapp


introduction to siemens Counter Instructions

Counters have memory area reserved for them in the memory of CPU. This memory area reserves one 16-bit word for each counter address. set counter preset value by entering a number from 0 to 999, for example : C#127. The C# stands for binary coded decimal format, 127 is a preset value of a counter. The ladder logic instruction set supports 256 counters. The counter instructions are the only functions that have access to the counter memory area.
    Avoid to use a counter at several points in program, sometime counting errors occured.
range for counter PV is 0 to 999. You can vary the count value within this range by using the following counter instructions:

S_CU, Up Counter Instructions

The counter is incremented by one if the signal state at input CU changes from 0 to 1, each rising edge signal at the inputs CU incrment counter value by 1.
    INPUT and OUTPUT of counter UP
  • C no. Counter identification number,numebr is diffrent for diffrent plc.
  • CU : counter up each rising edge incremnt counter value by 1. data type bool.
  • S : set the PV to CV data type bool.
  • PV : preset value of counter when S is set to 1 than PV value load to CV. data type word.
  • R : reset counter if value set to 1, data type Bool.
  • Q : output of counter is set to 1,. if Counter value CV is grater than 0.
  • CV : counter value in hexadecimal number format, data type word.
  • CV_BCD : counter value in BCD format, data type word.

siemens Up Counter Instructions

    in above example The counter is incremented by one if the CU is set to 1
  • C1 is a counter number.
  • at each rising edge at I0.0 increment counter value by 1 untill value of counter is equal to 999.
  • if I0.1 set 1 than Counter is preset with PV value C#999.
  • if I0.3 is set to 1 than I0.3 reset counter
  • Q is set to 1 if counter value is greater than zero, 0 if the count is equal to zero.
  • MW0 store the current value counter in hexadecimal format, CV reset if reset is set to 1.
  • CV_BCD store current value counter in bcd coded format.


S_CD, Down Counter Instructions

if the set (S) input is 1 and counter value CV is greater than 1. at each rising edge at input CD decremented counter value by 1 untill CV is equal to 0. output Q is 1 if the current counter value is greater than 0. output Q is 0, if the current counter value is equal to zero.
    INPUT and OUTPUT of counter down
  • C no. Counter identification number for counter block. for diffrent plc Counter no. is diffrent.
  • CD : counter Down, each rising edge decrement counter value by 1. data type bool.
  • S : set the preset value PV to CV data type bool.
  • PV : preset value of counter when S is set to 1 than PV value load to CV. data type word.
  • R : reset counter if value set to 1, data type Bool.
  • Q : output of counter is set to 1,. if Counter value CV is grater than 0.
  • CV : counter value in hexadecimal number format, data type word.
  • CV_BCD : counter value in BCD format, data type word.

siemens down Counter Instructions

    If I1.1 is "1", the counter is preset with the value of PV. than each rising edge at I1.0 decremented by 1, unless the value of counter is equal to 0. Q1.0 is 1 if counter is greater than 0.


S_CUD Up-Down Counter

Up-Down Counter perform UP or down counting bits , when input of CU changes 0 to 1 than counter increment counter value by 1 and if input CD changes 0 to 1 than counter decremented counter value by 1.output Q is 1 if the counter value is greater than zero and 0.
    if CD and CU input is set to 1 than counter value remains unchanged.
    INPUT and OUTPUT of counter up/down
  • C no. Counter identification number for counter block. for diffrent plc Counter no. is diffrent.
  • CU : counter up, each rising edge incremnt counter value by 1. data type bool.
  • CD : counter Down at each rising edge decrement counter value by 1. data type bool.
  • S : set the preset value PV to CV data type bool.
  • PV : preset value of counter when S is set to 1 than PV value load to CV. data type word.
  • R : reset counter if value set to 1, data type Bool.
  • Q : output of counter is set to 1,. if Counter value CV is grater than 0.
  • CV : counter value in hexadecimal number format, data type word.
  • CV_BCD : counter value in BCD format, data type word.

siemens up/down Counter Instructions

    if I2.0 is 1 and I2.1 is 0 incremnt counter value by 1, untill untill value of counter is equal to 999. if I2.2 is 1 than counter value set by counter Prset value PV, and if I2.1 is change from 0 to 1 and I2.0 is set to 0 than counter value MW22 decrement by 1. untill MW22 is equal to zero. output Q3.0 is 1 if value the counter value is greater than zero and 0.


Set Counter Value coil Instructions

this coil set, preset value into the specified counter.

siemens Set Counter Value coil Instructions

    if the input of I4.0 is 1 than counter coil set Preset value in counter C8.


Up Counter Coil Instructions

up counter coil incremnt counter value by 1 at specified counter number. each positive edge of the input contact increment counter value by 1 untill counter value is less than 999.

siemens up Counter Value coil Instructions

    if I4.0 is 1 set counter C8 Preset value, each rising edge of I4.1 increment counter value by untill C8 equal to 999.


down Counter Coil Instructions

The Down Counter instruction decrements the value of a specified counter by 1 if there is a signal change 0 to 1 at the input of coil.

siemens down Counter Value coil Instructions

    if I4.0 is 1 set counter C8 Preset value, each rising edge of I4.2 decrements counter value by untill C8 equal to 0.


example of siemens counter

in this example counter up instrunction is used, move instrunction set preset value. timer instrunction set 1 at the input of counter CU periodically every 2 second. compariosn block compare preset value and current value if both are equal than counter reset , and start from beginning. counter up reset if the value is greater than Preset value, counter up block input is depent on timer output, reset manually or bit depend on compariosn block.

siemens counter example

    move block set preset value both data type are word, compariosn block compare preset value and input value of move

siemens counter example

    periodically set input of counter CU every 2second

siemens counter example
 
Share on Facebook Share On Twitter Share on LinkedIn Share on Whatsapp


Suggested Post


 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

comment