PLC

UP Counter in PLC Programming

  • Programmable Logic Controllers (PLCs) are integral in industrial automation for controlling machinery and processes. 
  • Among the various instructions available in PLCs, counters play a vital role in counting events or objects. 
  • There are two primary types of counters used in PLCs: UP counters and DOWN counters. 
  • This guide focuses on UP counters, explaining their functionality, application, and programming.
  • An UP counter is a type of counter that increments its count value by one each time a specific event occurs. 
  • This event could be a sensor activation, a pulse from a button press, or any other detectable occurrence. 
  • UP counters are used in various applications such as counting products on a conveyor belt, tracking the number of operations, and more.
  1. Counter Value (CV): The current value of the counter.
  2. Preset Value (PV): The target value at which the counter will trigger an output.
  3. Count Up (CU): The input that, when activated, increases the counter value by one.
  4. Set Input (S): Sets the counter to the preset value  when the set input ( S) is set to 1.
  5. Preset reached Output (D): The output that becomes active when the counter value reaches the preset value.
  6. Reset (R): The input used to reset the counter value to zero.
  1. Initialization: Set the preset value (PV) to the desired target count.
  2. Counting: Each time the count-up input (CU) is activated, the counter value (CV) increments by one.
  3. Output Activation: When the counter value (CV) equals the preset value (PV), the output (Q) is activated.
  4. Resetting: If needed, the reset input (R) can be activated to set the counter value (CV) back to zero.

Click here for Step-by-Step Guide: Converting Electrical Diagrams into PLC Programs for Industrial Automation

Here is a basic example of how to implement an UP counter in ladder logic:

Example of UP Counter in Ladder Logic

In this example:

  • CU is the count-up input.
  • C0 is the counter block
  • D is the output that gets activated when the counter reaches the preset value.
  • R is the reset input.
  • In a bottling plant, we need to count the number of bottles passing a specific point on a conveyor belt. 
  • When the count reaches 10, a signal is sent to a packaging machine to start the packaging process.
  • To create and simulate a ladder diagram for an up-count operation in a bottling plant using Schneider Electric’s EcoStruxure Machine Expert – Basic, follow these steps. 
  • This scenario counts bottles on a conveyor belt and sends a signal to a packaging machine after every 10 bottles.
  • Launch the software and open a new project or an existing one.

Click here for Step-by-Step Procedure for Creating a Ladder Diagram from Logic with Schneider Electric EcoStruxure Machine Expert Basic Software

UP Counter in PLC Programming 1
  • BOTTLE_SENSOR (%I0.2): Detects bottles passing a point on the conveyor.
  • RESET_COUNT (%I0.0): Resets the bottle count.
  • MANUAL_BYPASS (%I0.1): Manually bypasses the counting logic.
  • COUNT_REACHED (%M0): Indicates that 10 bottles have been counted.(Memory bit)
  • PACKING_START (%Q0.1): Starts the packaging machine.
UP Counter in PLC Programming 2
  • Reset the counter: Add a Normally Open (NO) contact for RESET_COUNT connected to the reset (R) input of the counter COUNTER_%C0.
  • Manual Bypass: Add a Normally Open (NO) contact for MANUAL_BYPASS to bypass the counting when needed.
  • Bottle Sensor: Add a Normally Open (NO) contact for BOTTLE_SENSOR connected to the Count Up (CU) input of the counter COUNTER_%C0.
  • Counter Block: Add the counter block COUNTER_%C0 with a preset value of 10.
  • Count Reached: Add a Normally Open (NO) contact for the counter’s output %M0 to indicate the count has reached 10.
  • Count Reached Signal: Add a Normally Open (NO) contact for %M0 to start the packaging machine when the count reaches 10.
  • Packaging Machine Start: Connect this to the output coil PACKING_START (%Q0.1).
UP Counter in PLC Programming 3
  • When the system starts, the counter is initialized and waits for the sensor signals.
  • Each time a bottle passes the sensor, BOTTLE_SENSOR (%I0.2) sends a signal to the counter block COUNTER_%C0.
  • The counter increments by one for each bottle detected.
  • If RESET_COUNT (%I0.0) is activated, the counter resets to zero.
  • If MANUAL_BYPASS (%I0.1) is activated, the counter logic is bypassed, and no counting occurs.
  • Once the counter reaches the preset value of 10, the COUNT_REACHED (%M0) flag is set.
  • This flag triggers the PACKING_START output coil (%Q0.1), sending a signal to start the packaging machine.
  • The packaging machine starts its operation based on the signal from the PLC.

Click here for Understanding ON Delay and OFF Delay Timers in PLC Programming

UP Counter in PLC Programming 4
  1. Start the simulation.
  2. Trigger the BOTTLE_SENSOR input repeatedly until the counter reaches 10.
  3. Observe the COUNT_REACHED memory bit (%M0) being set to True when the count is 10.
  4. Verify the PACKING_START output (%Q0.1) is activated, indicating the packaging machine starts.

This setup ensures that the bottling plant counts bottles and initiates the packaging process automatically after every 10 bottles, optimizing the workflow and ensuring efficiency in the production line.

Click here for Designing 2 out of 4 Voting Logic in Control Systems: A Step-by-Step PLC Ladder Diagram Tutorial with Video

  • Production Line Counting: Counting the number of products passing a certain point on a conveyor belt.
  • Machine Operation Cycles: Tracking the number of cycles a machine has completed.
  • Event Monitoring: Counting specific events such as the number of times a door is opened.

Click here for More PLC Articles

Sundareswaran Iyalunaidu

With over 24 years of dedicated experience, I am a seasoned professional specializing in the commissioning, maintenance, and installation of Electrical, Instrumentation and Control systems. My expertise extends across a spectrum of industries, including Power stations, Oil and Gas, Aluminium, Utilities, Steel and Continuous process industries. Tweet me @sundareshinfohe

Related Articles

Back to top button

Adblock Detected

We Noticed You're Using an Ad Blocker Hi there! We understand that ads can be annoying, but they help support our website and allow us to continue providing you with high-quality content. Please consider whitelisting our site or disabling your ad blocker while you visit. Your support means a lot to us! Thank you for understanding!