FM350-2 Counter Module Overview
The SIMATIC FM350-2 is a function module for the S7-300 automation system that provides eight counter channels for direct connection of 24 V incremental encoders and other pulse sources (NAMUR initiators, photoelectric barriers, proximity switches). The module integrates into the S7-300 backplane bus, is configured through STEP 7 V5.x or via the TIA Portal, and exposes its operating, count, and diagnostic data through a parameter data block assigned by the user (typically DB2 or the next free data block after the FB/FC instance).
The module is the standard choice for high-speed counting tasks such as position detection, length measurement, flow metering, and rotational speed monitoring. It supports the following operating modes per channel:
- Continuous counting with or without hardware gate
- Single counting with or without hardware gate
- Periodic counting with or without hardware gate
Each channel has a comparator that triggers an output when the load value matches the actual value, plus a measured-value interface for runtime data.
CPU 315-2DP System Compatibility
The FM350-2 is fully compatible with the CPU 315-2DP (6ES7 315-2AG10-0AB0 and related variants). The module is recognized in the STEP 7 hardware catalog under SIMATIC 300 > FM-300 > FM350-2 Counter Module. Once inserted into the hardware configuration, the FM350-2 occupies 16 bytes of I/O area in the PII/PIQ of the CPU and requires a parameter data block (DB) for the parameter assignment interface.
Prerequisites for a clean integration:
- STEP 7 V5.3 or later (the project in the original support case uses V5.3, which is fully supported).
- GSD/GSDML not required - the module is centrally configured.
- Firmware of the FM350-2 must be compatible with STEP 7 V5.3. The Configuration Package for FM350-2 V4.0 SP3 supplies the correct GSD/replacement files and the operating software.
Hardware Setup: Wiring the E100H35-1024-3-T-24 Encoder
The encoder referenced in the support case is the E100H35-1024-3-T-24:
- 1024 pulses per revolution (PPR)
- 3 channels: A, B (quadrature), and Z (zero/index pulse)
- T-24: 24 V push-pull (totem-pole) output, short-circuit protected
- Open cable end or M12/connector, depending on variant
Connect the encoder to the FM350-2 40-pin front connector (6ES7 392-1AM00-0AA0). For channel 0 (the most common choice for a single-encoder application), the relevant terminals are:
| Signal | Terminal (Ch.0) | Notes |
|---|---|---|
| +24 V encoder supply | 1 | Internally fused, max 500 mA per channel |
| 0 V (ground) | 2 | Reference for encoder signals |
| Track A (24V) | 3 | Differential input, inverting = 18 |
| Track B (24V) | 4 | Differential input, inverting = 19 |
| Track Z (24V) | 5 | Reference pulse; inverting = 20 |
| Hardware gate input | 6 | Digital input for HW gate |
| Sensor supply 24 V | 7 | External sensor supply |
Wiring rules for direction recognition (this is the core of the original case):
- Both Track A and Track B must be wired. A 24 V push-pull encoder outputs two TTL-equivalent square waves with 90° phase shift. If only Track A is wired, the FM350-2 cannot detect direction - the count simply increments on every pulse edge regardless of rotation.
- Wire the encoder supply (red/brown wire, typically) to terminal 1 and 0 V to terminal 2. The module provides 24 V out; do not feed external 24 V into terminal 1.
- For quadrature decoding (single, double, or quadruple evaluation), the module is set in HW Config. Quadruple evaluation multiplies the 1024 PPR into 4096 increments per revolution and provides the cleanest direction detection.
Software Installation: Configuration Package V4.0 SP3
The Configurating Package for Counter Module FM350-2 V4.0 SP3 installs the following components:
- Hardware Support Package (HSP) entries for the FM350-2 family
- The operating software (parameter assignment interface) for online parameterization
- STEP 7 V5.3/V5.4/V5.5 sample projects demonstrating CNT2_CTR, CNT2_WR, CNT2_RD, and DIAG_RD calls
- PDF manual and Getting Started documentation
After installation, the documents are accessible from the Windows start menu under Siemens Automation > Documentation > SIMATIC > S7-300 > FM350-2. The official Siemens entry point for the configuration software, including corrections and the readme with installation prerequisites, is the Siemens Industry Online Support article Configuration Software for FM 350-2 Counter Module (ID 28554065).
Verify a successful install by opening HW Config, expanding SIMATIC 300 > FM-300 > Counter modules, and confirming that the FM350-2 entry is present.
STEP 7 Hardware Configuration
- Open the S7 project in STEP 7 V5.3 and double-click Hardware.
- Insert a SIMATIC 300 rack and place the CPU 315-2DP in slot 2.
- Drag the FM350-2 from the catalog onto a free slot (typically slot 4-11). HW Config auto-assigns the I/O addresses, e.g., 288..303 for input and 288..303 for output (varies by project).
- Double-click the FM350-2 to open its properties dialog. Enter the start address of the parameter DB (e.g., DB2). The FM350-2 will write its parameter image to this DB.
- Click Properties > Addresses and confirm that the parameter DB number matches the DB used by the sample program (DB2 by default).
- Compile and download the hardware configuration to the CPU.
Parameter Assignment: DBW12 and DBD14
The user-defined parameter data block (typically DB2) carries the operating parameters of the FM350-2. The most important fields during commissioning are:
| Offset | Type | Name | Meaning |
|---|---|---|---|
| DBW0 | WORD | STS_SLOT | Slot / module status |
| DBW12 | WORD | MOD_MODE / Operating mode | Counting mode and direction handling |
| DBD14 | DWORD | LOAD_VALUE / Comparison value | Load value or upper count limit |
| DBW44 | WORD | STS / Status word | Per-channel status (gate, direction, comparator, error) |
| DBW46 | WORD | ACT_COUNT | Actual count value of the channel |
DBW12 - Operating mode configures each channel's counting behavior. A typical value is a hex constant that combines:
- Continuous vs. single vs. periodic counting
- Single, double, or quadruple evaluation (only with both A and B connected)
- Direction recognition: enable/disable
- Hardware gate usage
Set the operating mode before setting the hardware gate. The FM350-2 accepts the parameter set on the rising edge of the gate or on the next CNT2_WR call.
DBD14 - Load/upper limit value defines the comparison threshold for the channel's comparator. When the actual value reaches this threshold, the comparator output toggles. In continuous counting with upper limit mode, reaching DBD14 causes the counter to roll over to zero (or to the lower limit defined in DBD18). In single counting mode, the count stops at DBD14.
Status and Count Value Interpretation (DBW44 / DBW46)
Once the FM350-2 is parameterized and the hardware gate is open, the runtime data appears at the documented offsets in the parameter DB:
-
DBW44 (STS) - Status word, bit-encoded. Common bits:
- Bit 0: SW gate 0 (1 = open)
- Bit 1: SW gate 1 (1 = open)
- Bit 4: Direction (1 = negative direction; 0 = positive direction) when direction evaluation is enabled
- Bit 8: Comparator 0 output (1 = reached)
- Bit 12: Channel 0 error
- DBW46 (ACT_COUNT) - Actual count value of channel 0, read with CNT2_RD. Updates on every count pulse (or on the configured edge).
If DBW46 is increasing monotonically regardless of rotation direction, direction evaluation is not active. The two most common causes are:
- Track B of the encoder is not wired to the FM350-2 input.
- DBW12 is configured for "count up only" or single-edge evaluation without direction logic.
If DBW44 shows no change at all while the encoder rotates, the encoder is not delivering pulses to the module. Check the encoder supply (terminal 1 should be +24 V referenced to terminal 2), the wiring continuity, and the encoder's input type selection (24 V sink/source). For an E100H35-1024-3-T-24, the output is push-pull - the FM350-2 must be jumpered for 24 V input mode (default for channel input type "24 V").
Resolving the Direction Recognition Issue
Step-by-step procedure to restore correct up/down counting:
- Power down the S7-300 station and disconnect the encoder cable.
- Inspect the cable: confirm four distinct signal conductors (A, B, Z, plus shield) and two supply conductors. Many 5-wire encoder cables include a direction signal that is not used on the FM350-2 - use A, B, and Z only.
- Re-terminate Track A to terminal 3, Track B to terminal 4, Track Z to terminal 5 (channel 0). Use shielded twisted pairs and ground the shield at the cabinet entry only.
- Re-apply power and load the STEP 7 project.
- In the operating software, set channel 0 to quadruple evaluation (or double evaluation if you want slower response) and enable direction recognition.
- Open the SW gate from the user program (call CNT2_CTR with CTRL = 16#1).
- Rotate the encoder clockwise (looking at the shaft). DBW46 should increment, and the direction bit in DBW44 should read 0. Reverse rotation: DBW46 decrements (provided you have set a non-zero lower limit in DBD18), and the direction bit in DBW44 toggles to 1.
After correcting the wiring, the user in the original support case confirmed: "I reconfigured the wiring which I used to connect the encoder with the counter module. After I changed the wiring config it works."
Sample Parameter Settings (DB2 for one channel)
The Configuration Package for FM350-2 V4.0 SP3 ships a sample DB2 that can be used as a starting point. A minimal, well-commented example for channel 0 only is shown below. Open DB2 in STEP 7 and edit the data view directly, or use the parameter assignment interface.
DATA_BLOCK DB 2
TITLE = 'FM350-2 Parameter DB (Channel 0)'
VERSION : 0.0
STRUCT
// --- Module header / reserved ---
RESERVED_00 : WORD ; // DBW0
RESERVED_02 : WORD ; // DBW2
RESERVED_04 : WORD ; // DBW4
RESERVED_06 : WORD ; // DBW6
RESERVED_08 : WORD ; // DBW8
RESERVED_10 : WORD ; // DBW10
// --- DBW12: operating mode (hex) ---
// Bit 0 = 0: count up only (no direction) - change to 1 for direction evaluation
// Bit 4 = 1: quadruple evaluation of A/B (for 1024 PPR -> 4096 inc/rev)
// Bit 8 = 1: hardware gate enabled
// Bit 12 = 1: software gate enabled
OP_MODE : WORD := W#16#1310;
// --- DBD14: load value / upper count limit ---
LOAD_VAL : DWORD := DW#16#00000FFF; // 4095 decimal = 1 rev @ quadruple
// --- DBD18: lower count limit (for up/down) ---
LOW_VAL : DWORD := DW#16#00000000; // 0 decimal
// --- DBW44 / DBW46: runtime data (read-only) ---
STS_CH0 : WORD ; // DBW44 status word, channel 0
ACT_COUNT_0 : WORD ; // DBW46 actual count, channel 0
STS_CH1 : WORD ; // DBW48 status, channel 1
ACT_COUNT_1 : WORD ; // DBW50 actual count, channel 1
END_STRUCT ;
END_DATA_BLOCK
To start counting from the user program (OB1), call the FB/FC provided in the configuration package:
// Open SW gate for channel 0
CALL FB 2, DB 3 // FB2 = CNT2_CTR wrapper from sample project
CTRL := W#16#0001 // bit 0 = open SW gate channel 0
STS := MW 100
ERR := MW 102
For the full FB/FC API (CNT2_CTR, CNT2_WR, CNT2_RD, DIAG_RD), refer to the TIA Portal help page Using FM 350-2 from the user program (S7-300, S7-400). The TIA Portal V20 documentation covers the same API as STEP 7 V5.5 - the function block signatures are identical.
Verification Checklist
After configuration and parameter download, walk through the following verification matrix before handing the station over to production:
| Step | Expected result | Verification |
|---|---|---|
| LED status of FM350-2 | SF off, BF off, channel 0 ACT or DIR LED blinking per encoder rotation | Visual inspection |
| DBW44 bit "SW gate 0" | = 1 after CNT2_CTR call with bit 0 set | Monitor in VAT or HMI tag |
| DBW46 increments on CW rotation | Steady increment, value matches PPR × evaluation factor | Rotate encoder exactly 1 rev; expect increment of 4096 |
| DBW46 decrements on CCW rotation | Steady decrement until LOW_VAL is reached | Reverse 1 rev; expect decrement of 4096 back to start |
| DBW44 direction bit | Toggles between CW (0) and CCW (1) | Force rotation in each direction; check bit |
| Comparator output (DBW44 bit 8) | Goes high at DBD14, resets at DBD18 (in periodic mode) | Simulate count with FB2 test function |
| No SF diagnostic entries | Diagnostic buffer empty for FM350-2 | STEP 7 > PLC > Diagnostic/Setting > Diagnostic Buffer |
Diagnostic Codes and Common Faults
The FM350-2 writes diagnostic data that the user program can read with the DIAG_RD instruction (referenced in the official TIA Portal documentation). Typical diagnostic events:
| Symptom | Likely cause | Action |
|---|---|---|
| SF LED on, "parameter error" | DBW12 reserved bits set, or DBD14 outside allowed range | Re-load parameters from sample DB |
| SF LED on, "encoder error" | Wire break on A or B; short circuit on 24 V supply | Check terminal 1 voltage under load; inspect cable |
| DBW46 frozen at 0 | SW gate not opened, or encoder not powered | Set SW gate, measure +24 V at terminal 1 |
| DBW46 increases only | Track B missing or direction disabled in DBW12 | Wire Track B; enable direction bit in DBW12 |
| Count value oscillates near 0/MAX | Encoder near zero index, Z-pulse interaction | Disable Z in DBW12 if unused |
Frequently Asked Questions
Is the FM350-2 compatible with CPU 315-2DP?
Yes. The FM350-2 is a standard S7-300 function module and is supported by the CPU 315-2DP (6ES7 315-2AG10-0AB0 and compatible variants). It is configured centrally in HW Config of STEP 7 V5.3 or later and the Configuration Package FM350-2 V4.0 SP3 supplies the matching HSP.
Why does DBW46 keep increasing even when I rotate the encoder backwards?
Direction evaluation requires both Track A and Track B to be wired, and the operating mode in DBW12 must enable direction recognition with at least double evaluation. If only Track A is connected, or the direction bit in DBW12 is cleared, the counter increments on every pulse regardless of rotation direction.
Where do I download the configuration software for the FM350-2?
Get the latest version of the configuration software (including the readme and corrected binaries) from the Siemens Industry Online Support article Configuration Software for FM 350-2 Counter Module (ID 28554065). The package is a self-extracting archive and must match the STEP 7 version in use.
What does DBD14 represent and what value should I use for a 1024 PPR encoder?
DBD14 is the load value or upper count limit, depending on the operating mode in DBW12. For a 1024 PPR encoder in quadruple evaluation (4096 increments per revolution), set DBD14 = 4095 for a single full revolution cycle. For periodic counting, set DBD18 to define the lower limit.
What is the difference between DBW44 and DBW46?
DBW44 is the status word for channel 0, containing bit-coded information such as SW gate state, direction (when enabled), comparator output, and channel errors. DBW46 is the actual count value of channel 0, updated on every count pulse. Both are read-only from the user program perspective.
How do I read FM350-2 diagnostics from STEP 7?
Use the DIAG_RD instruction, which is documented for the FM350-2 in the TIA Portal help page Using FM 350-2 from the user program. The instruction populates a CNT2_CHANTYPE data block with diagnostic data, including error codes and channel state.