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
- FM 350-1 Hardware Counter Architecture
- STEP 7 Sample Code vs Native PCS 7 Driver Blocks (Pcs7Cnt1)
- Pulse-to-Position Conversion and Scaling Mathematics
- Counter Processing Implementation Comparison
- Step-by-Step Procedure to Implement Position Feedback in CFC
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
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,648to+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:
ACT_CNTV * ScaleFactorIntegral(Speed * dt)Step-by-Step Procedure to Implement Position Feedback in CFC
Method: Configuring FM 350-1 with Pcs7Cnt1 in CFC
- In HW Config, configure the FM 350-1 module: Set operating mode to Continuous Counting with encoder type 24V Incremental.
- Note the module's logical I/O start address (e.g.
256). - Open the target CFC chart in the CFC Editor.
- From the PCS 7 Basis Library, drag block
Pcs7Cnt1(FB840) into the chart. - Connect parameter
LADDRto the hardware module start address (e.g.W#16#100for address 256). - Interconnect a dedicated global DB structured according to
UDT1(FM_DATA) to block inputFM_DATA. - Insert an APL
Mul02(REAL Multiplication) block. - Convert
Pcs7Cnt1.ACT_CNTV(DINT) to REAL using converter blockDiToReal, and connect toMul02.In1. - Set
Mul02.In2to your calculatedScaleFactor(e.g.0.36). - Route
Mul02.Outto an analog monitoring block (MonAnL) for operator faceplate display and limit alarming in WinCC.
Verification
To verify position calculation accuracy:
- Zero Point Verification: Set the mechanical mechanism to mechanical zero (0°); confirm that
ACT_CNTV = 0andMonAnL.PV_Out = 0.0. - Forward Motion Check: Rotate the shaft forward by 90°. Confirm that count reaches 250 pulses and calculated position displays
90.0°. - 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,647wraps 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
- Siemens AG: SIMATIC S7-300 FM 350-1 Counter Module Manual (Doc No. A5E00057788)
- Siemens AG: SIMATIC Process Control System PCS 7 Basis Library Manual (Doc No. A5E03419561)
- Siemens Industry Online Support Entry ID 109760968: SIMATIC PCS 7 Advanced Process Library Manual
Related Articles
- https://industrialautomation.net/search?query=fm350-1+pcs7cnt1+cpc+position+feedback+scaling
- https://industrialautomation.net/search?query=incremental+encoder+pulse+to+engineering+units+cfc
- https://industrialautomation.net/search?query=fm350-1+continuous+counting+mode+setup
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