Rslogix 500 Counter Instructions

Published on Jul01, 2021 | Category: instructions
Share this article:

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.

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. .

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.

img/counter/counterup.webp

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.

img/counter/counterdown.webp

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

img/counter/counterdatafilesopen.webp

img/counter/counterdatafiles.webp

Addressing of counter

Assign counter addresses using the format C5:e.s/Ce

img/counter/counterunderflow.webp

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.

img/counter/resetcounter.webp

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.

img/counter/countersetpoint.webp

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.