Overview of the Siemens FM 350-1
The Siemens FM 350-1 is a single-channel, high-speed counter and measurement function module for the SIMATIC S7-300 PLC family. It reads pulse trains from incremental encoders (24 V asymmetric or RS-422 5 V differential), performs counting, measurement, and comparison functions, and reports the result back to the CPU over the S7-300 backplane bus. The base order number most often referenced in field installations is 6ES7350-1AH01; Siemens subsequently released 6ES7350-1AH02 and 6ES7350-1AH03 revisions with extended diagnostics and revised firmware. The FM 350-1 must not be confused with the FM 350-2 (6ES7350-2AH00-0AE0), which is an 8-channel counter module with its own configuration software and a different block interface.
Typical applications for the FM 350-1 include length and distance measurement on converting machinery, piece counting on packaging lines, rotational speed feedback for closed-loop control, and event counting with hardware interrupts triggered by comparator events. The module supports continuous, single, and periodic counting, two comparator outputs, three digital inputs for hardware gating, latching, and synchronization, and a non-volatile retention area for the current count.
Each FM 350-1 occupies a single slot in the S7-300 rack and is configured as a function module (FM) rather than a standard I/O module. Programming access is performed through a dedicated FM 350-1 Configuration Software package that installs function blocks, function calls, and user-defined data types (UDTs) into the STEP 7 project, and that registers the module type in HW Config.
Module Variants and Order Numbers
| Order Number (MLFB) | Function | Notes |
|---|---|---|
| 6ES7350-1AH00 | FM 350-1, 1-channel counter | Initial release; functionally superseded |
| 6ES7350-1AH01 | FM 350-1, 1-channel counter | Hardware interrupt support; widely deployed |
| 6ES7350-1AH02 | FM 350-1, 1-channel counter | Improved diagnostics and revised FW |
| 6ES7350-1AH03 | FM 350-1, 1-channel counter | Current production; identical FB/FC interface to -1AH02 |
The FM 350-2 must not be substituted for the FM 350-1: it has a different slot profile, different configuration software, different FB/FC names, and eight independent counter channels. The configuration software of the FM 350-2 will not recognize an FM 350-1 module, and vice versa.
Technical Specifications
| Parameter | Value | Notes |
|---|---|---|
| Counter channels | 1 | Independent counting path |
| Maximum counting frequency | 500 kHz (24 V), 500 kHz (RS-422 5 V differential) | Verify against the MLFB-specific data sheet |
| Counting range | 0 to 4 294 967 295 (32-bit unsigned) or -2 147 483 648 to +2 147 483 647 (32-bit signed) | Selected in HW Config |
| Encoder supply | 24 V (configurable current limit) or 5 V (RS-422) | Short-circuit and overload protected |
| Digital inputs | 3 (24 V, type 1 per IEC 61131-2) | Gate, latch, synchronization |
| Digital outputs | 2 (24 V, 0.5 A, short-circuit protected) | Comparator outputs |
| Counting modes | Continuous, single, periodic | Hardware and software gate |
| Hardware interrupts | Yes | On comparator, gate end, overflow, zero pulse |
| Counting evaluation | 1x, 2x, 4x (quadrature) | Per phase-A/B direction |
| Operating temperature | 0 °C to 60 °C | S7-300 standard |
| Backplane power consumption | ≈ 0.6 W | Plus encoder load on front connector |
| Required front connector | 40-pin (6ES7392-1AM00-0AA0) | Not included with module |
Front Connector Wiring
The FM 350-1 requires a 40-pin front connector (typically the 6ES7392-1AM00-0AA0 screw-type). The connector carries the encoder signals, the digital I/O, and the encoder supply. The pinout below is the canonical assignment; on the -1AH03 revision, Siemens added labels on the inside of the front flap.
Front Connector X1 Pinout (Simplified)
| Terminal | Signal | Description |
|---|---|---|
| 1 | +24 V encoder supply | +24 V out to encoder |
| 2 | GND encoder supply | 0 V reference |
| 3 | A | Encoder track A (24 V or 5 V) |
| 4 | A̅ | Encoder track A inverted (RS-422 only) |
| 5 | B | Encoder track B (24 V or 5 V) |
| 6 | B̅ | Encoder track B inverted (RS-422 only) |
| 7 | N | Zero/index pulse |
| 8 | N̅ | Zero/index pulse inverted (RS-422 only) |
| 9 | DI0 | Hardware gate (24 V input) |
| 10 | DI1 | Latch / set input (24 V input) |
| 11 | DI2 | Synchronization input (24 V input) |
| 12 | DO0 | Comparator 1 output (24 V, 0.5 A) |
| 13 | DO1 | Comparator 2 output (24 V, 0.5 A) |
| 14 | M | Ground reference for DI/DO |
| 20 | Shield | Cable shield termination |
Mechanical Installation
- Open the front flap of the FM 350-1 to access the 40-pin front connector.
- Strip and ferrule all conductors; label each using the supplied numbering strip.
- Wire the encoder, digital I/O, and power on the front connector.
- Insert the keyed front connector into the module and tighten the two locking screws.
- Apply the supplied labeling strip and click the front flap closed.
- Power up the S7-300 rack; the SF (group error) LED should be off if the wiring is correct and the module is recognized.
Configuration Software Installation
The FM 350-1 is configured through the dedicated FM 350-1 Configuration Software, which is supplied on CD with the module and is also available through Siemens Industry Online Support. This is a separate install from STEP 7 V5.x and TIA Portal: it adds the FM 350-1 parameter editor to HW Config and copies the FBs, FCs, and UDTs into the project.
Important: the FM 350-2 Configuration Software is not interchangeable with the FM 350-1 package. The FM 350-2 documentation is published separately and ships its own FB/FC set; using the FM 350-2 software with an FM 350-1 will produce a build error in STEP 7 because the symbolic names differ.
Installation Steps
- Insert the FM 350-1 CD or mount the downloaded ISO.
- Run
SETUP.EXE; the installer prompts for STEP 7 path and target language. - Confirm the install completes; the FM 350-1 type appears in HW Config under the FM catalog.
- Open STEP 7, then open the S7 program to verify that the new UDTs and FBs are visible in the program editor.
- Rebuild the program; STEP 7 will refresh the symbol table with the new FM 350-1 entries.
Hardware Configuration in STEP 7 (HW Config)
- Open the SIMATIC Manager project, select the S7-300 station, and double-click Hardware.
- Insert the FM 350-1 from the hardware catalog into an SM/FM slot of the rack.
- Double-click the module to open its Properties dialog.
- Configure the encoder interface (24 V or RS-422), counting mode (continuous / single / periodic), counting range, gate control (HW / SW), comparator values, and interrupt behavior.
- Click OK to write the configuration to the project.
- Save, compile, and download the hardware configuration to the CPU.
The FM 350-1 occupies 16 bytes of I/O address space. The default address depends on the slot and is shown in HW Config. The configuration software reads the assigned addresses from HW Config and writes them into the data block structure consumed by the FBs.
User Program Integration: FCs, FBs, and UDTs
The FM 350-1 configuration package installs the following building blocks into the STEP 7 program editor:
| Block | Type | Symbolic Name | Function |
|---|---|---|---|
| FC 0 | FC | CNT_CTL1 (or "FM350_CNT") | Counter control, primary job dispatcher |
| FC 1 | FC | CNT_CTL2 | Alternative job interface for parallel calls |
| FC DIAG_INF | FC | DIAG_INF | Reads module diagnostic data |
| FB | FB | CNT_CTL | Encapsulated counter control with instance DB |
| UDT 1 | UDT | CHANNEL_DB | Channel structure for FM 350-1 |
| DB | DB | DB_CNT (instance) | Generated automatically when FC 0 is first used |
As documented in the FM 350-1 operating instructions: "FC DIAG_INF can be called within the cycle, and in the interrupt program. If you set the counter via the FC_CNT_CTL1 call, this can initiate a hardware interrupt." The complete reference for the FC and the channel structure is in the S7-300 FM 350-1 Operating Instructions (PDF).
Programming Example: Length Measurement with FC 0
The following S7-SCL skeleton shows how a length-measurement application typically wires FC 0 (CNT_CTL1) into OB1. The instance DB (DB_CNT) is generated by the FM 350-1 configuration tool and contains the channel structure. The diagram below summarizes the data flow between the user program, FC 0, and the FM 350-1 module.
// OB1 - cycle
// Inputs:
// iEncoderPulseCount : INT - pulses per encoder revolution
// iMmPerRev : REAL - mm traveled per revolution
// bStart : BOOL - operator start command
// bReset : BOOL - operator reset command
// Outputs:
// rLength_mm : REAL - current measured length
// bComparatorOut : BOOL - DO0 comparator reached
IF bReset THEN
// Job code 4 = "Set counter to load value"
"DB_CNT".JOB := 4;
"DB_CNT".LOAD_VAL := 0;
END_IF;
IF bStart THEN
// Job code 1 = "Enable software gate"
"DB_CNT".JOB := 1;
END_IF;
// Call FC 0 - it executes the job above and refreshes the channel DB
FC0(IN := "DB_CNT");
// Read live counter value (DWORD) and convert to length
rLength_mm := DWORD_TO_REAL("DB_CNT".ACT_CNT)
/ INT_TO_REAL(iEncoderPulseCount)
* iMmPerRev;
// Comparator output is mirrored in channel DB and on physical DO0
bComparatorOut := "DB_CNT".CMP1_REACHED;
Job codes supported by FC 0 include:
| Job Code | Meaning |
|---|---|
| 0 | No job (idle) |
| 1 | Enable software gate (start counting) |
| 2 | Disable software gate (stop counting) |
| 3 | Read counter value into user data |
| 4 | Set counter to LOAD_VAL |
| 5 | Set comparator 1 to CMP_VAL1 |
| 6 | Set comparator 2 to CMP_VAL2 |
| 7 | Trigger HW interrupt on gate end |
| 9 | Acknowledge diagnostic interrupt |
| 10 | Set HW gate behavior (level / edge) |
| 12 | Read / set latch value |
Retaining the Counter Value After STOP-RUN or Power Off
The originating field question is straightforward: "The PLC is off, the value of counter goes to 0. How can I remember the counter value?" The FM 350-1 supports a retentive counter, but it must be explicitly enabled in HW Config and the project must be brought up with the correct settings. Without intervention, the FM 350-1 starts every RUN transition at zero.
Module-Level Retention (Recommended for Length / Batch Counting)
- Open the FM 350-1 Properties dialog in HW Config.
- Navigate to the Counter or Retentive Behavior page (label varies by firmware version).
- Enable the option "Retentive counter value" or set Behavior on CPU STOP / Power Off to "Retain".
- Compile and download the new hardware configuration.
With this option active, the FM 350-1 writes the current count into its non-volatile memory at each job boundary and on detection of power-down. On the next CPU RUN transition or module power-up, the value is reloaded before counting resumes. The retentive memory area on the FM 350-1 also preserves the comparator values and the load value, so the module returns to the same operational state it was in before the outage.
Application-Level Fallback When Retention Is Not Used
If retention is disabled (for example, to extend the FM 350-1 service life), the value can still survive a CPU STOP-RUN transition by using a retained DB in the CPU's work memory. In STEP 7, mark the DB as "Non-retentive" = No (i.e., retentive) and read/write the counter there:
// OB100 - warm restart / power-up
// Restore the counter from the retained DB
"DB_CNT".JOB := 4; // Set counter to load value
"DB_CNT".LOAD_VAL := "DB_HIST".LAST_CNT; // load previous count
FC0(IN := "DB_CNT");
// OB1 - cycle
// Periodically write the live counter back to the retained DB
IF "DB_CNT".STS_READY THEN
"DB_HIST".LAST_CNT := "DB_CNT".ACT_CNT;
END_IF;
The retained DB survives CPU STOP, warm restart, and power-off, provided the CPU has a battery or buffered MMC installed. On an S7-300 CPU 31x with no backup battery, the retentive DB is lost on power-down; in that case, the FM 350-1 module-level retention is the only safe path.
Diagnostics and Error Handling
The FM 350-1 reports channel-level diagnostics through both LED indicators on the front panel and structured diagnostic data readable through FC DIAG_INF. The SF LED lights for any of the conditions listed below.
| Condition | SF LED | Action |
|---|---|---|
| Wire break on encoder track (A, B, or N) | On (red) | Check shield, twisted pair, and encoder supply |
| Counting frequency exceeded | On (red) | Reduce input speed or enable HW input filter |
| Hardware gate fault (signal not present) | On (red) | Check HW gate wiring and signal level |
| Module parameter mismatch | On (red) | Re-download HW Config |
| Power supply out of range | On (red) | Check 24 V and 5 V encoder supply |
| Counter overflow / underflow | Off (status bit set) | Reset counter or widen count range |
| Comparator overrun (count past CMP2 with mode "outside") | Off (status bit set) | Adjust comparator values |
FC DIAG_INF is typically called from OB82 (diagnostic interrupt) or from OB1 to populate a structured area with channel-specific error codes. Per the FM 350-1 operating instructions, "FC DIAG_INF can be called within the cycle, and in the interrupt program"; the call returns the most recent diagnostic event for the channel. The structured output includes the channel number, the event class, and a 16-bit error code whose meaning is documented in the manual's diagnostic data section.
Diagnostic OB Integration
| OB | Triggered By | Recommended Action |
|---|---|---|
| OB 40 | Hardware interrupt from FM 350-1 (comparator, gate end) | Read OB40_POINT_ADDR, latch value, set next comparator |
| OB 82 | Diagnostic interrupt (module inserted / removed, fault) | Call FC DIAG_INF; set operator flag; clear SF LED via job 9 |
| OB 100 | Warm restart / power-up | Restore counter from retained DB; call FC 0 with job 4 to load |
Encoder Selection and Mechanical Setup
The choice of encoder interface directly determines the maximum cable length and noise immunity of the system.
| Encoder Type | Interface | Max Cable (Typical) | Use Case |
|---|---|---|---|
| 24 V asymmetric (open-collector / push-pull) | DI only, single-ended A/B/N | ≤ 50 m | Factory floor, short runs, low cost |
| 5 V RS-422 differential | DI plus inverted A̅/B̅/N̅ | ≤ 300 m | Long runs, VFD environments, high resolution |
| HTL push-pull (24 V) | 24 V symmetric, no inverted | ≤ 100 m | Industrial, mid-distance, single-ended robustness |
Mount the encoder on a rigid bracket to keep vibration away from the coupling; vibration above the FM 350-1 input bandwidth can be miscounted, especially at 1x evaluation. For linear measurement with a measuring wheel, ensure the wheel is spring-loaded against the material to avoid slip, and account for material thickness and elasticity in the pulses-per-mm calculation.
Counting Modes in Depth
| Mode | Behavior | Typical Use |
|---|---|---|
| Continuous counting | Counter increments or decrements indefinitely; rolls over at 32-bit boundary | Length measurement, position feedback |
| Single counting | Counter starts at LOAD_VAL on gate open, stops at upper limit, waits for next gate open | Piece counting, batch control |
| Periodic counting | Counter cycles between LOAD_VAL and upper limit; reloads LOAD_VAL on overflow | Reciprocating motion, fixed-window measurement |
Verification and Commissioning
- With the wiring complete and the HW Config downloaded, the SF LED on the FM 350-1 must be off and the "RUN" LED green.
- Open an online watch table on
DB_CNT; theJOBfield should accept values andSTS(status word) should report Ready. - Spin the encoder slowly by hand or drive it with a known pulse source;
ACT_CNTshould increment. - Toggle the hardware gate input; the status word must reflect the gate state change.
- Trigger the comparator with a test value of
CMP_VAL1; DO0 must energize on the front connector andCMP1_REACHEDmust latch in the DB. - Run a STOP-RUN test: place the CPU in STOP, then in RUN; verify
ACT_CNTeither retains (if retentive mode is on) or is reloaded from the retained DB (if application-level fallback is used). - Trigger a power cycle on the S7-300 rack; the FM 350-1 must restart and re-load the counter (when module-level retention is enabled).
- Verify counter direction by manually rotating the encoder in the defined positive direction;
ACT_CNTmust increase. - Verify quadrature evaluation by commanding a 4x test pulse train (one full quadrature cycle = four counts) and confirming the expected count.
Troubleshooting Matrix
| Symptom | Likely Cause | Action |
|---|---|---|
| SF LED on at startup | Encoder wiring or parameter mismatch | Re-check wiring; re-download HW Config |
| Counter reads 0 after every STOP-RUN | Retention not enabled, and no application-level fallback | Enable retentive counter in HW Config; add DB_HIST persistence in OB100 |
| Counter reads 0 after power cycle on battery-less CPU | No module-level retention, no buffered MMC | Enable FM 350-1 retentive counter, or fit backup battery / MMC |
| Count is wrong by factor of 4 | 4x quadrature evaluation enabled in HW Config | Match counting mode to encoder resolution; or adjust pulses-per-mm |
| Count is wrong by factor of 2 | 2x evaluation instead of 1x | Switch evaluation mode in HW Config |
| Counter counts in wrong direction | Phase A and B swapped | Swap A and B at the front connector |
| Comparator never asserts DO0 | CMP_VAL1 outside count range, or DO0 disabled | Check CMP_VAL1 in DB_CNT; ensure DO0 enabled in HW Config |
| Hardware interrupt never fires | Interrupt source not enabled in HW Config | Enable "HW interrupt on gate end" / "on comparator" |
| FC 0 build error: symbol not found | FM 350-1 configuration software not installed | Install FM 350-1 Configuration Software; regenerate FBs |
| Wire-break diagnostic after long cable run | 24 V asymmetric over long distance, no termination | Switch to RS-422 (5 V differential); add 150 Ω termination across A/A̅ and B/B̅ |
| Encoder supply trips off after connect | Short circuit on encoder cable | Disconnect encoder; measure resistance; check wiring |
| DIAG_INF returns all zeros in OB1 | No diagnostic event pending | Force a wire break to test; call DIAG_INF after OB82 instead |
| Counts drift over time at constant speed | Encoder mounting slip; electrical noise on 24 V input | Re-tension coupling; switch to RS-422; check shield bonding |
Migrating to FM 350-2 or to TM Count
For projects that outgrow the single channel of the FM 350-1, Siemens offers the FM 350-2 (8 channels) and, on newer S7-300 CPUs and on the ET 200S / ET 200SP distributed I/O, the TM Count 2x24V technology module. The user-program interface for the FM 350-2 is documented in the Siemens TIA Documentation Hub entry "Using FM 350-2 from the user program (S7-300, S7-400) - STEP 7". The block names differ; FC 0 of the FM 350-1 is replaced by the FM 350-2 FB with an instance DB. For new installations on PROFINET, prefer the ET 200SP TM Count module, which integrates the encoder supply and comparator outputs directly over PROFINET and removes the backplane dependency.
Safety and Operational Notes
Documentation and Reference Material
Refer to the official FM 350-1 operating instructions, available from Siemens Industry Online Support: S7-300 FM 350-1 Operating Instructions (PDF). For multi-channel installations and the parallel FM 350-2 reference, use the TIA Portal / STEP 7 documentation: Using FM 350-2 from the user program (S7-300, S7-400).
Which FC do I call to read and start the FM 350-1 counter?
Call FC 0 (CNT_CTL1) from OB1. FC 0 executes the job you write into the channel DB (JOB field). Use job code 1 to enable the software gate and start counting; the actual count is read back from the same DB at ACT_CNT.
Why does my counter value reset to 0 after CPU power-off?
The FM 350-1 only retains the counter value if the "Retentive counter value" option is enabled in HW Config (FM 350-1 Properties dialog). Without this option, the value is lost on power cycle. Alternatively, mirror the counter into a retentive DB on the CPU side and re-load it in OB100.
Can I use the FM 350-2 configuration software for the FM 350-1?
No. The FM 350-1 and FM 350-2 are different modules with different configuration packages. Installing only the FM 350-2 software will leave the FM 350-1 unrecognized in HW Config. Install the FM 350-1 Configuration Software that ships with the module (order number 6ES7350-1AH01).
How do I trigger a hardware interrupt from the FM 350-1?
In the FM 350-1 Properties dialog in HW Config, enable "HW interrupt on comparator", "HW interrupt on gate end", or "HW interrupt on overflow" as required. The configuration package wires the corresponding OB (typically OB40) to the module's interrupt line. The interrupt source can also be checked at runtime via the channel DB status word.
What is the maximum counting frequency on the FM 350-1?
The published figure for the FM 350-1 family is 500 kHz, applicable to both the 24 V asymmetric and the RS-422 (5 V differential) encoder inputs. Verify the value for the exact MLFB in use against the data sheet, because component revisions (-1AH01 vs -1AH03) can tighten the published limits, especially for the encoder supply current budget.