Converting Pulse Counts to Position Feedback Using FM 350-1 and Pcs7Cnt1 in SIMATIC PCS 7

Converting Pulse Counts to Position Feedback Using FM 350-1 and Pcs7Cnt1 in SIMATIC PCS 7

To convert pulse counts from an FM 350-1 counter module into continuous position or angular feedback in SIMATIC PCS 7, do not rely on standard STEP 7 sample blocks with UDT2. Instead, deploy the standard PCS 7 channel driver block Pcs7Cnt1 (FB840) or FM_CNT (FB126) from the PCS 7 Basis Library. In Continuous Counting mode, the driver cyclically reads the actual 32-bit count value ACT_CNTV. To convert counts into engineering position units (such as degrees or millimeters), multiply ACT_CNTV by a scaling factor ScaleFactor = (EngineeringRange / PulsesPerRevolution) using an APL Mul02 block or scale parameters. Continuous counting naturally increments and decrements with rotational direction, maintaining true position tracking.

Table of Contents

Executive Summary

High-speed counting and positioning tasks in SIMATIC PCS 7 are routinely handled using the single-channel FM 350-1 counter module (6ES7350-1AH03-0AE0). When interfacing incremental encoders to track mechanical shaft position, valve travel, or rotary table angles, automation engineers frequently start with standard STEP 7 sample projects containing UDT2 and CNT_CTL1. However, these sample structures lack PCS 7 AS-OS engineering integration, APL faceplates, and automatic module driver support. Furthermore, uncertainty arises regarding whether integrating speed (RPM) or reading the continuous count accumulator (ACT_CNTV) provides accurate reversible position tracking. Understanding how Pcs7Cnt1 handles bidirectional pulse streams and scaling math ensures deterministic position monitoring.

FM 350-1 Hardware Counter Architecture

The FM 350-1 module executes high-frequency counting independently of CPU cycle times:

  • Supports 1 channel for 24V or 5V incremental (RS422) encoders up to 500 kHz.
  • In Continuous Counting Mode, the internal 32-bit counter tracks counts from -2,147,483,648 to +2,147,483,647.
  • Tracks phase A and phase B quadrature signals, automatically incrementing on clockwise rotation and decrementing on counter-clockwise rotation.
  • Reversing direction retains absolute count integrity (e.g. moving from 10° to 30° and returning to 10° returns exactly to the original pulse count).

STEP 7 Sample Code vs Native PCS 7 Driver Blocks (Pcs7Cnt1)

In PCS 7, avoid legacy STEP 7 sample blocks:

  • Legacy STEP 7 (CNT_CTL1 / UDT2): Requires manual data block management and cannot generate WinCC diagnostic alarms.
  • PCS 7 Native Driver (Pcs7Cnt1 / FB840): Standard APL/Basis Library block that integrates into the automated driver generation chain (Generate Module Drivers). It reads raw count registers via peripheral addressing and exposes real-time values (ACT_CNTV), status quality codes, and hardware fault diagnostic flags.

Pulse-to-Position Conversion and Scaling Mathematics

Integrating pulse frequency or RPM over time introduces cumulative floating-point drift and truncation errors. True position must be derived directly from the hardware count accumulator:

  • Position Formula: Position = ACT_CNTV * ScaleFactor + Offset
  • Where: ScaleFactor = Total Engineering Units per Rev / Total Pulses per Rev.
  • For example, with an encoder generating 1,000 pulses per 360° rotation: ScaleFactor = 360.0 / 1000.0 = 0.36 °/pulse.
  • A count of 500 yields: 500 * 0.36 = 180.0°.

Counter Processing Implementation Comparison

The following table compares methods for calculating position from FM 350-1 pulses in PCS 7:

Calculation MethodMathematical BasisReversible Tracking?Long-Term AccuracyRecommended Use CaseDirect Accumulator ScalingACT_CNTV * ScaleFactorYes (Bidirectional)100% Deterministic (Zero Drift)Linear positioning, shaft angle, valve position.RPM IntegrationIntegral(Speed * dt)ImperfectAccumulates drift over timeProhibited for absolute positioning; flow totalizing only.SCL Software CounterIncrements on digital DIRate LimitedMisses pulses above 50 HzLow-speed carton counting on standard DI cards.TotalL APL BlockAPL floating-point totalizerUnidirectionalMinor floating-point roundingLiquid volume batching.

Step-by-Step Procedure to Implement Position Feedback in CFC

Method: Configuring FM 350-1 with Pcs7Cnt1 in CFC

  1. In HW Config, configure the FM 350-1 module: Set operating mode to Continuous Counting with encoder type 24V Incremental.
  2. Note the module's logical I/O start address (e.g. 256).
  3. Open the target CFC chart in the CFC Editor.
  4. From the PCS 7 Basis Library, drag block Pcs7Cnt1 (FB840) into the chart.
  5. Connect parameter LADDR to the hardware module start address (e.g. W#16#100 for address 256).
  6. Interconnect a dedicated global DB structured according to UDT1 (FM_DATA) to block input FM_DATA.
  7. Insert an APL Mul02 (REAL Multiplication) block.
  8. Convert Pcs7Cnt1.ACT_CNTV (DINT) to REAL using converter block DiToReal, and connect to Mul02.In1.
  9. Set Mul02.In2 to your calculated ScaleFactor (e.g. 0.36).
  10. Route Mul02.Out to an analog monitoring block (MonAnL) for operator faceplate display and limit alarming in WinCC.

Verification

To verify position calculation accuracy:

  1. Zero Point Verification: Set the mechanical mechanism to mechanical zero (0°); confirm that ACT_CNTV = 0 and MonAnL.PV_Out = 0.0.
  2. Forward Motion Check: Rotate the shaft forward by 90°. Confirm that count reaches 250 pulses and calculated position displays 90.0°.
  3. Reverse Motion Check: Rotate the shaft backward to zero. Confirm that count returns to 0 without deadband error or hysteresis drift.

Limitations and Operational Precautions

  • Counter Rollover: In continuous counting, passing +2,147,483,647 wraps to -2,147,483,648; if machines rotate indefinitely, implement periodic homing or software rollover detection.
  • Power Failure Data Loss: Incremental encoders lose absolute position on power loss; always implement a homing limit switch routine to reset the counter on machine startup.
  • Noise Suppression: Use shielded twisted-pair cables for encoder signals and ensure shield grounding clamps are installed directly at the ET 200M shield busbar.

Engineer FAQ

Does ACT_CNTV maintain negative count values when rotating backward past zero?

Yes, the FM 350-1 internal counter is a signed 32-bit integer that decrements into negative values seamlessly.

Can Pcs7Cnt1 be used with FM 350-2 modules?

No, Pcs7Cnt1 is dedicated to the 1-channel FM 350-1; the 8-channel FM 350-2 requires block CNT_CTL or FM_CNT.

How fast can the FM 350-1 read pulses?

The FM 350-1 supports pulse input frequencies up to 500 kHz for 5V differential signals and 200 kHz for 24V signals.

Technical References

Related Articles

Related Tags

  • https://industrialautomation.net/search?query=simatic-pcs7
  • https://industrialautomation.net/search?query=fm350-1
  • https://industrialautomation.net/search?query=counter-module
  • https://industrialautomation.net/search?query=cfc-editor
6 respuestas