A Guide to High-Speed Counters (HSC) used in Programmable Logic Controllers (PLCs)
A high-speed counter (HSC) is a functional capability within particular PLCs. HSCs count the frequency of the pulse of processes from systems with elements such as high-speed encoders. In these cases, special input modules ensure the count’s accuracy and deliver the output to the system element within the latency criteria that optimizes machine or system uptime to meet throughput requirements. Normal (software) counters are adequate unless the pulses you are counting will arrive faster than 2 times the scan time. For example, if the scan time is 2ms and pulses arrive every 4ms or longer, then use a normal software counter. If they arrive less than 4ms apart, use the hardware (high-speed) counters. (2xscan time = 2x2ms= 4ms).
HSC Overview and Application
An HSC is a select type of counter. Counters used in systems with lower pulse frequencies (CTU/Ds) can be implemented as a software-defined PLC element. Thus, it only exists virtually. The HSC requires a hardware input module that can operate reliably in the harsh environmental conditions experienced on a factory floor.
The engineering design is a simple input/output device that uses ladder logic to develop the output signal from the inputs provided. After all, counters can only count up, down, or bi-directionally based on the logic required. However, the human-machine interface (HMI) is another issue. Each PLC manufacturer has its unique terminology and logic sequence to consider when setting the HSC up for proper operation. This lack of standardization is a problem and causes confusion. In general, we will be using Allen Bradley PLC terminology.
Counting is a widespread need in PLC programming. You will need to count a variety of inputs. For example, a parking garage has only so many parking spaces. Each parking space can have a sensor that that feeds a counter that counts both up and down and warns a driver not to enter the garage because there no open spots. Or, you might need to gauge whether you are on track to meet throughput expectations for this production run.
Counters are used to take many inputs from a production line operational control app (SCADA) and track statistics, such as how often an alarm is going off or how often a pressure relief valve is lifting in response to an unsafe condition.
HSC Terminology and Process Allen Bradley Example
Recall that a HSC is a variation of a typical counter that has to monitor a high-speed input. The HSC instruction in the ladder programming logic must be enabled. That instruction must be set to a “TRUE” value to enable the HSC option or “FALSE” to disable it.
The table below shows some of the terminologies you will encounter. The HSC documentation will give a short explanation of the settings for each mnemonic, as just demonstrated for the HSC mnemonic. You’ll notice that this list of instructions covers both timing and counter operations.
|TON||Timer On-Delay||Counts time base intervals when the instruction is true|
|TOF||Timer Off-Delay||Counts time base intervals when the instruction is false|
|RTO||Retentive Timer||Counts time base intervals when the instruction is true and retains the accumulated value when the instruction goes false or when a power cycle occurs|
|CTU||Count Up||Increments the accumulated value at each false-to-true transition and retains the accumulated value when the instruction goes false or when a power cycle occurs|
|CTD||Count Down||Decrements the accumulated value at each false-to-true transition and retains the accumulated value when the instruction goes false or when a power cycle occurs|
|HSC||High-Speed Counter||Counts high-speed pulses from a fixed controller high-speed input|
|RES||Reset||This command resets the accumulated value and status bits of a timer or counter. Do not use it with TOF timers.|
Table sourced from psu.edu
From the documentation that comes with the app code and input hardware module for the HSC, you will want to familiarize yourself with any specifications, use instructions, and an example of how to do the HSC setup. Read through this information, so you get it right the first time.
Comparison to Setting Up a Click PLC HSC Counter
The purpose here is to show you why the learning curve from one PLC brand to another can be confusing and can take time to become proficient in a new piece of software. The hardware setup will be different, as well. So, keep focused and keep your product information and instructions handy for a while.
First off, make sure you have the most recent software release for programming the HSC. The dropdown menus will guide you to the right place to begin the programming process. In this case, “High-Speed Input Setup” is what you’re looking for—clicking on that entry will dropdown a list of mnemonics, names, and descriptions.
|Name||Default name for the high-speed count. HighSpeedCount1.|
|Assign Nicknames automatically||leave checked|
|Current Count Value||Set to DD1 – (PV) present value of the high-speed counter.|
|Type||Select Up Count. All different modes for this counter.|
|Up||Set to X1 Rising Edge. What you selected for the setting TYPE will impact what you use here.|
|Use Reset||Self-explanatory – resets the HSC back to|
|Use Enable||It causes a bit to enable counting.|
You can see that these are different terms than what we just saw with the Allen Bradley process. Plus, the ladder logic (software program) was written much differently as well. Yet, it accomplishes the same purpose.
Counters in PLCs are an obscure but critical part of all PLCs. They can be a software-defined, virtual entity having low-frequency inputs to process. In high-speed input cases, a hardware input module must be designed to ensure the control process’s proper operation to ensure the outputs’ accuracy and timely delivery.
Have a question, or an idea for an article? Ask in the comments below, or reach out to us on Social Media!