Resetting and Operating the PCS 7 High-Speed Counter Block Pcs7Cnt1 in CFC

Resetting and Operating the PCS 7 High-Speed Counter Block Pcs7Cnt1 in CFC

In SIMATIC PCS 7, resetting the counter value on the high-speed counter channel block Pcs7Cnt1 (FB127, used with FM 350-1, FM 350-2, or ET 200 counter modules) upon completing a loading sequence is performed using the Software Gate input SWGateEn or the direct loading parameter L_Direct. Toggling SWGateEn from 1 to 0 and back to 1 closes and re-opens the counter gate, re-initializing the count to zero when configured for 'Periodic counting with gate reset'. Alternatively, asserting L_Direct := 1 directly transfers the value defined at Load_Val (typically 0) into the hardware counter register, resetting the live accumulated count without disrupting fieldbus communication.

Table of Contents

Executive Summary

In material handling, fluid batching, and bulk loading terminals automated with SIMATIC PCS 7, high-speed pulse signals from positive displacement meters, turbine flowmeters, or optical encoders are processed using specialized counter hardware (such as FM 350-1 / FM 350-2 or ET 200SP High-Speed Counter modules) coupled to the driver block Pcs7Cnt1. When a truck loading or vessel dosing sequence finishes, the accumulated kilogram or liter count must be reset cleanly before the next batch initiates. Field engineers frequently struggle because simply writing zero to the output pin does not affect the physical counter module. This technical guide explains the gating and direct-load mechanisms of Pcs7Cnt1 and provides the exact CFC reset sequence.

Architecture and Fundamental Mechanics

Pcs7Cnt1 Counter Gating and Reset Mechanics

+-------------------------------------------------------------------------+
|                    HARDWARE COUNTER MODULE (FM 350 / TM Count)          |
|                                                                         |
|   - Physical Pulse Input: 24V / RS-422 Encoder Pulses (Flowmeter)       |
|   - Internal Counting Register: 32-Bit Signed DINT Register             |
+-----------------------------------|-------------------------------------+
                                    |
                                    v Cyclic I/O Peripheral Data (PZD)
+-------------------------------------------------------------------------+
|                      APL Driver Block: Pcs7Cnt1 (FB127)                 |
|                                                                         |
|   CONTROL MECHANISM 1: Software Gate Toggle (SWGateEn)                  |
|   - SWGateEn: 1 -> 0 (Gate Closed, Counting Pauses)                     |
|   - SWGateEn: 0 -> 1 (Gate Opens, Counter Re-initializes to 0)          |
|                                                                         |
|   CONTROL MECHANISM 2: Direct Load Execution (L_Direct)                 |
|   - Load_Val: L#0 (Desired Reset Target)                                |
|   - L_Direct: Pulse from 0 -> 1                                         |
|   - Commands hardware register to overwrite live count with Load_Val!   |
+-----------------------------------|-------------------------------------+
                                    |
                                    v Output to Batch Sequence
+-------------------------------------------------------------------------+
|   - Count_Out (Live Count): Resets to 0.0 kg                            |
|   - Status Word updates: Gate active, ready for next loading batch      |
+-------------------------------------------------------------------------+

Comparison of Reset Methods

  1. Software Gate Enable (SWGateEn):
    - How it works: The FM 350 module evaluates an internal software gate combined with the hardware gate. When configured in HW Config for 'Continuous count' or 'Count once with gate reset', toggling SWGateEn to 0 halts the counter; re-asserting 1 resets the count to the defined start value (0).
    - Best for: Clean batch sequence boundaries where loading begins with gate open and finishes with gate close.
  2. Direct Loading (L_Direct and Load_Val):
    - How it works: When L_Direct transitions from 0 to 1, Pcs7Cnt1 transmits a control job to the module requesting an immediate overwrite of the counting register with the value present at Load_Val.
    - Best for: On-the-fly zeroing, tare operations, or pre-setting a batch countdown value without toggling the gate enable signal.

Step-by-Step Implementation Procedure

Step 1: Verify Hardware Module Operating Mode in HW Config

  1. In SIMATIC Manager, open HW Config.
  2. Double-click the counter module (FM 350-1 or TM Count 1x24V) to open Object Properties.
  3. Navigate to the Basic Parameters / Operating Mode tab.
  4. Ensure the counting mode is set to Count once or Continuous counting with Gate Control: Software gate enabled.
  5. Confirm the load value on gate open is set to 0.
  6. Save and compile HW Config.

Step 2: Implement CFC Logic for Software Gate Reset

  1. Open the CFC chart containing the Pcs7Cnt1 block.
  2. Locate the input pin SWGateEn (Software Gate Enable).
  3. Interconnect your batch control logic or push-button trigger:
    - During loading: Maintain SWGateEn := 1.
    - At loading completion: Set SWGateEn := 0 to halt counting.
    - At the start of the new batch: Pulse SWGateEn := 1. The module clears the internal accumulator to zero and begins counting pulses for the new batch.

Step 3: Implement Direct Reset via L_Direct (Alternative Method)

  1. If continuous counting is required without closing the software gate:
  2. Connect parameter Load_Val := L#0 (or the desired preset value) on Pcs7Cnt1.
  3. Connect a rising-edge pulse from your reset button (e.g., via a pulse block Pulse or one-shot logic) to the input L_Direct.
  4. When the pulse fires (0 -> 1), Pcs7Cnt1 commands the counter module to overwrite its active register with Load_Val.

Step 4: Scale Pulses to Engineering Units (Kilograms)

  1. The counter output Cnt_Out outputs raw integer counts.
  2. Insert an analog conversion block (Mul02 or TotalL).
  3. Multiply Cnt_Out by the meter calibration factor (e.g., 0.05 kg/pulse).
  4. Route the scaled output to WinCC displays and batch loading reports.
  5. Compile CFC via Changes Only and download to the AS.

Verification

  1. Gate Toggle Test: Run a test count until Cnt_Out reaches e.g. 5,000 pulses. In CFC online test mode, toggle SWGateEn to 0 then 1. Verify that Cnt_Out returns instantly to 0.
  2. Direct Load Test: Generate counts. Pulse L_Direct := 1. Verify that the counter register is immediately overwritten with 0.
  3. Pulse Accumulation Verification: Resume pulse input. Confirm that the counter resumes accumulating smoothly from 0 upwards without data overflow faults.

Limitations and Operational Precautions

  1. Asynchronous Command Latency: Direct load commands (L_Direct) execute asynchronously over the backplane bus; allow 1 to 2 OB cycles (100–200 ms) for the module to acknowledge and update the output.
  2. Hardware Gate Precedence: If physical hardware gates (inputs on the counter module terminal) are wired and configured, the physical gate must also be closed/enabled; software commands cannot override an open hardware gate.

Engineer FAQ

Which input resets the counter on Pcs7Cnt1?

The counter can be reset by toggling SWGateEn (Software Gate Enable) or pulsing L_Direct with Load_Val set to 0.

What does SWGateEn stand for?

Software Gate Enable, controlling the internal start/stop and initialization gate of the hardware counter module.

What is L_Direct?

An input pin that triggers a direct load of the parameter Load_Val into the physical module's counting register.

Why did writing zero to Cnt_Out not reset the count?

Cnt_Out is an output reflecting the physical counter register; you must command the module via control pins (SWGateEn or L_Direct).

What modules are supported by Pcs7Cnt1?

SIMATIC FM 350-1, FM 350-2, and ET 200 high-speed counter modules (such as 1Count24V / TM Count).

How do I convert pulse counts to kilograms?

Multiply the integer count by the pulse calibration coefficient (kg per pulse) using an analog multiplication block (Mul02).

Can Pcs7Cnt1 count in both directions?

Yes, if configured with a bi-directional incremental encoder (A/B quadrature signals), it counts up and down.

What happens if the counter exceeds its maximum limit?

When reaching 2,147,483,647 (32-bit DINT limit), it either stops or rolls over depending on HW Config settings.

Does resetting the counter require stopping the AS?

No. Resetting the counter via SWGateEn or L_Direct is a normal runtime control operation in RUN.

Where can I find the Pcs7Cnt1 block manual?

In the SIMATIC PCS 7 Basis Library manual under Chapter 'Counter and Frequency Measurement Drivers'.

Technical References

Related Articles

Related Tags

  • Pcs7Cnt1
  • Counter Reset
  • SWGateEn
  • L_Direct
  • FM 350-1
  • High-Speed Counter
  • CFC Engineering
20 respuestas