Category Archives: Counters

Up, down, interval, flashing, memory retentive, etc counters are discussed.

PLC Fiddle Counter Challenge

Counters are used in allot of PLC programs that I have seen. A timing chart is the secret behind understanding of the counter that you need in your application. Making a timing chart before writing the program will ensure that all of the information will be accounted. The secret to using counters is a good review of using these timing charts.

PLC Fiddle has three different counter instructions for us to use in our programs. Count UP, Count Down and Reset. We will discuss the counter parameters and the three different instructions. Our counter challenges will help you gain a good understanding of how counters work in the PLC. Let’s get started. Continue Reading!

Productivity 1000 Series PLC Counter Instructions

A majority of programmable logic controller (PLC) programs will include a counter instruction. The Productivity 1000 Series PLC has a couple of different counter instructions for your program. Under the data handling instructions we have the increment / decrement instruction (INC). We could use this with the compare contact (CMP) instruction that we discussed in our Contact and Coil Instructions (Video) to create a counter application.

The productivity suite software has a Simple Counter (SCNT) and the Counter (CNT) instructions. We will be reviewing these instructions and looking how to implement then in our ladder logic program. Let’s get started. Continue Reading!

BRX PLC Counters

A majority of the programmable logic controller (PLC) programs will include a counter instruction. The BRX series of programmable logic controllers have several different counters available for your program. There are five different basic counter instructions in the PLC. The memory area for counters (CT), include the Counter PVs (Present Values) Counter SVs (Set Values) and the Counter Completion Flags. The default size of the counter area is CT0 – CT255. This size can change to the amount that we need for our program. Please see BRX PLC Numbering Systems and Addressing on how to change the memory configuration of the controller.
We will be looking at the counter instructions in the BRX PLC along with some programming examples. As a system integrator, this ability can prove very useful to you in the field when commissioning your automation system. When dealing with counters, we need to look at timing charts. The Secret of Using Counters is a good refresher on using timing charts.
Let’s get started with the BRX PLC Counters. Continue Reading!

Omron CP1H Counters

The Omron CP1H series of programmable logic controllers are capable of having 4096 basic counters. There are two basic counter instructions in the PLC. Each of basic instructions can be either binary or BCD. The memory area for counters have separate areas for the Counter PVs (Present values) and the Counter Completion Flags. We will be looking at the basic Counter instructions in the CP1H along with some programming examples. Continue Reading!

Horner XL4 Timers and Counters

Timers and counters are used in the majority of PLC programs. We will not look at how timers and counters can be programmed in the Horner XL4 OCS all-in-one controller. Continue Reading!

PLC Programming Example – Delay Starting of 7 Motors

We will look at a PLC programming example of delaying the start of 7 motors. Each motor will be on a switch that the operator can select at any time. The motor outputs should have a 5 second delay between the outputs coming on.

This question originally came from PLCTalk.net. An original solution to the problem came from Peter Steinhoff. His solution is what we will be presenting. It is simple and straight forward.

We will be using the Do-more Designer software which comes with a simulator. This fully functional program is offered free of charge at automation directKeep on Reading!

Click PLC Timers and Counters

Continuing our series, we will now look at timers and counters and how they are used in the Click PLC. Previously we have discussed:
Click PLC System Hardware
Click PLC Installing the Software
Click PLC Establish Communication
Click PLC Numbering System and Addressing
The programming software and manuals can be downloaded from the Automation Direct website free of charge.  Keep on Reading!

PLC Programming Example – Paint Spraying

We will look at a PLC basic tutorial of a paint spraying station. Following the 5 steps to program development this PLC programming example should fully explain the procedure for developing the PLC program logic. Ladder will be our PLC programming language.

We will be using the Do-more Designer software which comes with a simulator. This fully functional program is offered free of charge at automation direct.

Define the task:

What has to happen?
Paint Station 01

Paint spraying system where boxes are fed by gravity through a feeder magazine one at a time onto a moving conveyor belt. Upon the start signal, boxes are pushed towards the conveyor by valve 1. This is a cylinder which extends and retracts which operates switches S1 and S2 respectfully. A spraying nozzle paints each box as it passes under the paint spray controlled by valve 2. A sensor (S3) counts each box being sprayed. When 6 boxes have been painted the valve 2 shuts off (paint spray) and valve 1 (cylinder) stops moving boxes onto the conveyor. Three seconds later the conveyor stops moving and the hopper with its load moves forward (valve 3) where it is emptied. Ten seconds later the hopper returns to the original position. The cycle is then complete and waits for a start signal again.

Define the Inputs and Outputs:

Inputs:
Start Switch – On/Off (Normally Open) – NO
Stop Switch – On/Off (Normally Closed) – NC
S1 – Valve 1 (cylinder retract) On/Off – NO
S2 – Valve 1 (cylinder extend) On/Off – NO
S3 – Box Detected- On/Off – NO
Outputs:
Motor – On/Off (Conveyor Run)
Valve 1- Cylinder to feed boxes – On/Off
Valve 2- Paint Spray – On/Off
Valve 3- Cylinder to move hopper – On/Off

Develop a logical sequence of operation:

Fully understanding the logic before starting to program can save you time and frustration.

Sequence Table: The following is a sequence table for our paint spraying application.

Sequence Table
1 – Input / Ouput ON
0 – Input / Output OFF
x – Input / Output Does not Matter
When power goes off and comes on the sequence will continue. This means that we must use memory retentive areas of the PLC. The stop pushbutton will stop the sequence. The start will resume until the end.

Develop the PLC program:

The best way to see the development of the programmable logic controller program is to follow the sequence table along with the following program. You will see the direct correlation between the two and get a good understanding of the process.

This is the main process start and stop bit. V0:0 is used because it is memory retentive.
Paint Stn Program 1

Control of the Motor (Conveyor) and the paint spray is done with the V0:0 contact in front of the actual PLC output. The conveyor and paint spray will stop when the timer 0 is done. This is the delay after the last box is detected to allow the box to be painted and loaded onto the hopper.
Paint Stn Program 2

Control of the box movement onto the conveyor. As long as we have the process start and the hopper count is not complete this will allow the cylinder to put boxes on the conveyor.
Paint Stn Program 3

Count number of boxes in the hopper via S3. The counter is memory retentive.
Paint Stn Program 4

Timer to stop the conveyor and spray after the last box is detected for the hopper. This will allow time for the box to be sprayed and loaded into the hopper.
Paint Stn Program 5

Hopper movement to load and unload the boxes.
Paint Stn Program 6

The hopper unload timer is to unload the boxes and will then trigger the reset conveyor timer, box counter and the process start bit (V0:0).
Paint Stn Program 7

Test the program:

Paint Spraying
Test the program with a simulator or actual machine. Make modifications as necessary. Remember to follow up after a time frame to see if any problems arise that need to be addressed with the program.

Watch on YouTube : PLC Programming Example – Paint Spraying
If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

The Secret of Using Counters

funny_counter

Counters  are used in the majority of PLC programs. This is especially true if part of your SCADA system. Counters like the animated picture above count things. In this situation we are counting the number of turns the little guy makes. The counter is displaying the total number. This is considered a totalizing counter. If an output turned on to do something then it would be a preset (target number entered for the count) counter. There are also a wide variety of off the shelf industrial counters that you can use. The implementation of counters can be vast, however it all starts with a TIMING CHART. This is the same as the timing charts we discussed in ‘The Secret of Timers’ post.

A timing chart is the secret behind understanding of the counter that you need in your application. Making a timing chart before writing the program will ensure that all of the information will be accounted.

The timing chart is mapped out on a x and y plain. The ‘y’ plain has the state of the input on/off (1 or 0). The ‘x’ plain will show time.

The following shows a timing chart for a counter:
timing chart counterAs you can see in this timing chart, you have an input, output and display.

Inputs:
Inputs are used usually sensors that are wired to the counter (PLC) to indicate the items that we need to count. They can be switches, photoelectric sensors, proximity sensors, encoders, etc. (Wiring of NPN / PNP devices) A counter will generally have only one input. In the case of an encoder input it is still only one input, however this is wired usually as a A, B and Z phase. Z is always the reset. A and B indicate the pulses and are leading or trailing each other by 90 degrees depending on direction. Allot of counters will also allow you to as a direction input signal. However this is all still only one input.
Output ModesInput Modes

Outputs:
Outputs from counters are generally discrete. This means that they are on or off, similar to the inputs. Outputs will trigger when the count value matches the set value. The duration that the output is on depends on the reset signal, to start the count again. (DC Solenoids protection) Allot of the counters today will allow you to have multiple outputs. These multifunction counters can have several preset outputs that trigger when the counter set value has been reached. Batch outputs are also available on some of the industrial counters. A batch output counts the number of times that the preset has been reached. This output will be turned on when the number entered for the batch has been reached.

Set Value – SV:
This is usually on the display and shows the preset value. It is the target number of counts.

Present Value – PV:
This is usually on the display and shows the current or accumulated value.

Roller Measurment

The PLC programming is usually not that much different then the industrial counter. Allot of the manufactures will have an up counter, down counter and/or an up/down counter. Just as the name implies the display is either counting up or down. You have to refer to the instruction manual of the manufacturer you are programming for the way in which the counter will be programmed.

Do-More Up and Down Counter

In the above example Do-More PLC program we have an up and a down counter. X0 is the input and X1 is the reset on both of these counters. (CT0, CT1)
The preset value is stored in memory location D0. This value is set to the number 3.
When the present value (accumulated) reaches the set value (preset) then the CT0.Done bit goes on and the output Y0 is active. Y0 will remain on until the reset input goes on.
The only difference for down counter is the display. You will see that the present value will count down to zero (0) before the CT1.Done bit is turned on.
These counters are memory retentive. So in order to make the counter non-memory retentive, use the first scan bit of the PLC to trigger the reset of the counter. (ST0 – $FirstScan)

Every PLC has counters. They all have different types depending on what you are trying to achieve. It will all start with your Timing Chart.

Watch on YouTube : Learn PLC Programming – Free 9 – The Secret of Counters

If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.