×

Subscribe to newsletter

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




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


rslogix 500 Counter Instructions

counter instruction are used to increment or decrement bit by one. counter, increment or decrement bits when input of counter is change form 0 to 1 or each rising edge of the bit. counter counts inputs bit when bit changes from 0 to 1 and counts are increment or decrement by one total no of count value is stored on counter accumulator value. rslogix 500 have counter up and counter down. you can address your counter up to 0 to 255 more than 255 and below 0 not allowed(C5:0 to C5:255). C5 represents counter file number 5, and 0 to 255 represent element number of counter. range of counter is -32768 to +32767.A counter can be reset to zero using the reset (RES) instruction. The true to false transition(changes of 0 to 1) of counter input signal is not faster than the scan time x2 (assuming a 50% duty cycle). in this condition you can use high speed counter. .
    preset and accumulated value is integer type so maximum range is 32767 and minimum range -32768. if the value is more than maximum range overflow (OV) bit set to 1 in counter up and if value is below the minimum range underflow (UN) bits set to 1.


RSLogix 500 : Count Up (CTU)

counter up increment the accumulator value by 1 when counter input bit changes form 0 to 1. if the counter up accumulated value is equal to preset value than counter done bit (DN) bit set to 1. you can use counter done bit(DN) for other rung or logic. if done bit is set to 1, each changes of input(0 to 1) increment accumulator value by 1 until it reach the maximum value (32767). when accumulator value is greater than 32767 than overflow bit is set to 1. for resetting of counter use reset instruction. parameters for counter up.
  • counter : declare the counter number. for example C5:0.
  • Preset Value (PRE) : preset value or set point of counter. it is defined by the programmer or depend on your process. if preset value is equal to Accumulated Value than done bit set to one.
  • Accumulated Value (ACC): Accumulated Value is the actual value of counter up. if counter input bit changes from 0 to 1 then accumulated value increment by one and resulted accumaltor value store in accumalator.
    accumulated value(ACC)=accumulated value(ACC) + 1.

RSLogix 500 : Count Up (CTU)

    in above ladder logic if I0:0/0(input counter) set to 1 than counter increment by one. each changes of I0:0/0 increment counter and value stored in accumulator. when Accumulator value is equal or grater than preset value done(DN) bit is set to 1 other wise 0.


RSLogix 500 : Count Down (CTD)

counter up decrement the accumulator value by 1 when counter input bit changes form 0 to 1. if the counter up accumulated value is equal to preset value than counter done bit (DN) bit set to 1. you can use counter done bit(DN) for other rung or logic. if done bit is set to 1, each changes of input(0 to 1) decrement accumulator value by 1 until it reach the minimum value (-32768). when accumulator value below than -32767 than underflow bit is set to 1. for resetting of counter use reset instruction. parameters for counter up.
  • counter : declare the counter number. for example C5:1.
  • Preset Value (PRE) : preset value or set point of counter. it is defined by the programmer or depend on your process. if preset value is equal to Accumulated Value than done bit set to one.
  • Accumulated Value (ACC): Accumulated Value is the actual value of counter. if counter input bit changes from 0 to 1 then accumulated value decrement by one and result store in accumulator.
    accumulated value(ACC)= accumulated value(ACC) - 1.

RSLogix 500 : Count Down (CTD)

    in above ladder logic if I0:0/1(input counter) set to 1 than counter decrement by one. each changes of I0:0/0 decrement counter and value stored in accumulator. when Accumulator value is equal or less than preset value done(DN) bit is set to 1 other wise 0.


Counter Data File Elements (C5:)

Counter Data File Elements (C5:) represent the statue of counter. This file stores the counter accumulator and preset values and status bits. for open data file of counter go to project > data files > C5-COUNTERfollowing of the counter data elements

Counter Data File Elements (C5:

  • CU - counter up : CU bool data type, if your counter is Counter up (CTU) and CU bit changes from 0 to 1 than accumulated value increment by one if your counter is counter down and CU bit changes from 0 to 1 than accumulated value have no changes.
  • CD - counter down : if your counter is Counter down (CTD) and CD bit changes 0 to 1 than accumulated value decrement by one,if your counter is counter up and CD bit changes from 0 to 1 than accumulated value have no changes.
  • DN - DONE BIT : data type bool, for counter up done bit (DN) set to 1 when accumulator value is equal to or greater than preset value. for counter down done bit is set to 1 when accumulator value is equal to or less than preset value.
  • OV - overflow bit : data type bool , set to 1 when accumulator value reach to above of the maximum limit of counter(+32767).
  • UN - Underflow bit : data type bool , set to 1 when accumulator value reach to below the minimum limit of counter(-32768).
  • UA - Update Accumulator bit : data type bool, Fixed Controller Only.
  • PRE - preset value : data type integer. Numeric value of counter also called set point. range for PRE maximum limit of counter +32767, minimum limit of counter -32768.
  • ACC - accumulator value : data type integer.it is a actual value of counter. range for ACC maximum limit of counter +32767, minimum limit of counter -32768.

Counter Data File Elements (C5:)

Addressing of counter

Assign counter addresses using the format C5:e.s/Ce
  • C : counter
  • e : elements number, range 0 to 255.
  • s: word element range 0 to 2.(PRE, ACC)
  • Ce: counter element (CU, CD, DN, OV, UN, UA, )
  • FOR EXAMPLE
    C5:0.ACC : accumulator value of counter no 0.
    C5:2.PRE : preset value of counter no 2.
    C5:0/OV : Overflow bit of counter no 0.
    C5:2/DN : done bit of counter no 0.

counter underflow bit

how to reset rslogix counter

you can reset your counter by RES [Reset] instruction. RES instruction reset control bit and accumulated value. when condition of rung is true than res instruction reset the counter. Make sure that the timer or counter being controlled by the reset instruction has the same address as the reset instruction. When resetting a counter, if the RES instruction is enabled and the counter rung is enabled, the CU or CD bit is reset. If the counter preset value is negative, the RES instruction sets the accumulated value to zero. This causes the done bit to be set by a count down or count up instruction.

how to reset rslogix counter

    in this example you can reset counter C5:0. if i:0/5 (reset counter) set to 1 than counter C5:0 will reset.

set the preset value of counter

in this example you can set the preset value. preset value is integer type so you can use integer N7 data file for setting the preset value.

set the preset value of counter


in this example when metal detector sensed metal in belt conveyor than change their status bit to 1. this bit used as counter up input. when metal detector detect metal than counter up increment by 1. if the accumulated value is equal to preset value than counter reset and separator remove all the material.

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