Resolving Unresponsive CTUD Counter Execution in Continuous Function Chart (CFC)
When the up/down counter CTUD (FB15) in Continuous Function Chart (CFC) fails to respond to input commands—such as failing to load preset value PV on a rising edge of S (SET) or ignoring count up (CU) and count down (CD) pulses—the failure is caused by instantiating the counter from the S7-300 elements library instead of the S7-400 elements library. In PCS 7, S7-300 elementary blocks rely on accumulator structures and system registers incompatible with S7-400 and CPU 410-5H runtime microcode. Deleting the S7-300 block instance and replacing it with CTUD from the CFC Library under 'S7-400 Elements' immediately restores normal counting and preset loading execution.
Table of Contents
- CFC Elementary Library Architecture: S7-300 vs S7-400 Elements
- Root Cause of Unresponsive CTUD Counter Behavior
- Remediation Procedure in CFC Editor
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
CFC Elementary Library Architecture: S7-300 vs S7-400 Elements
The SIMATIC PCS 7 CFC software package serves as a continuous graphical engineering tool for both SIMATIC S7-300 and S7-400 controller families. To support both hardware architectures, the default CFC block catalog provides two distinct branches of elementary logic blocks:
300elements: Elementary blocks (flip-flops, timers, counters, math functions) compiled specifically for the register and instruction set architecture of SIMATIC S7-300 and ET 200S CPUs.400elements: Elementary blocks compiled specifically for SIMATIC S7-400 and AS 410-5H processors.
Because PCS 7 is built exclusively on S7-400 and CPU 410 controllers, all elementary blocks instantiated in PCS 7 charts must originate from the 400elements container.
Root Cause of Unresponsive CTUD Counter Behavior
The table below details functional differences between the two CTUD implementations:
CTUD (FB15)CV, QU, QD freeze.CTUD (FB15)S loads PV to CV; pulses on CU/CD increment/decrement reliably.CountOh / CountScLRemediation Procedure in CFC Editor
To resolve the counter malfunction and instantiate the correct block:
Step 1: Remove Mismatched S7-300 Block Instance
- Open the affected CFC chart in the CFC Editor.
- Select the malfunctioning
CTUDblock and pressDelete. - In the CFC menu, select
Options->Block Types...-> click Clean Up to purge the S7-300 block type from the chart container.
Step 2: Instantiate S7-400 CTUD Counter
- In the CFC left catalog pane, expand Libraries -> CFC Library.
- Expand
400elements(orElementary Blocks->Counters). - Drag and drop
CTUDonto the chart canvas.
Step 3: Reconnect Signals and Recompile
- Reconnect input signals:
CU(Count Up),CD(Count Down),S(Set Preset),PV(Preset Value), andR(Reset). - Reconnect output signals:
QU(Counter High),QD(Counter Low), andCV(Current Count Value). - Compile CFC (
Compile->Changes only) and executeDownload Changesto the AS controller.
Verification
To verify that the newly instantiated CTUD counter operates correctly:
- Open the CFC chart in Online Test mode (eyeglasses icon).
- Set parameter
PV = 10and toggle parameterS(Set) from 0 to 1. - Verify that parameter
CV(Current Value) immediately updates to10. - Inject a rising edge pulse into parameter
CU: verify thatCVincrements to11. - Inject pulses into parameter
CD: verify thatCVdecrements accurately and that outputQDasserts whenCV <= 0.
Limitations and Operational Precautions
Operational boundaries when utilizing elementary counter blocks:
- Power-Loss Retention: Elementary blocks like CTUD store values in instance data blocks. If the CPU experiences a cold restart or memory reset without battery backup,
CVresets to zero; use retentive memory or APL counters if retention across restarts is required. - Integer Range Limits: Parameter
CVon classicCTUDis a 16-bit signed integer (INT), limiting counts to $0 \text{ to } 32,767$. For large-scale batch counts or pulse totals, deploy double-integer counters (DINT) or APL blocks (CountScL). - Edge Triggering Sensitivity: Inputs
CU,CD, andSrequire genuine boolean transition edges (0 to 1). If an upstream signal remains high continuously (1), the counter will not execute repeated counts.
Engineer FAQ
Why didn't the S7-300 CTUD counter work in an S7-400 CPU?
S7-300 elementary blocks utilize specific accumulator instructions and memory addressing tailored to S7-300 processor hardware. In an S7-400 CPU, internal edge evaluation fails, leaving the block unresponsive.
How do I know if an existing block was taken from 300elements or 400elements?
Right-click the block in CFC -> select Object Properties. Check the block header information and author field: it will indicate S7-300 or S7-400.
Does replacing the block require stopping the CPU?
No. Replacing the block, recompiling CFC changes, and downloading changes only can be performed while the CPU is in RUN mode.
What is the modern APL alternative to CTUD?
The PCS 7 Advanced Process Library provides blocks like CountOh (operating hours counter) and CountScL (scaling counter with limit monitoring and WinCC faceplates).
Technical References
- Siemens SIMATIC PCS 7 CFC for S7 Programming Manual (A5E39140302)
- Siemens SIMATIC S7-300/400 Elementary Blocks and Libraries Reference
- Siemens Industry Online Support Entry ID 109748909: Using Counters in CFC Charts
Related Articles
- Resolving CFC Download Error Block Already Exists in the CPU (FC3220, DB10237)
- Exporting and Auditing Inverted Binary Interconnections in SIMATIC PCS 7
- Locating and Monitoring SFC Type Instances in Continuous Function Chart (CFC)
Related Tags
- CTUD
- CFC
- Counter
- S7-400-Elements
- 300elements
- Elementary-Blocks