FM 350-1 5V Encoder: HW Config, X2 Wiring, and FC Setup

David Krause16 min read
PLC HardwareSiemensTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

FM 350-1 Module Overview and Variants

The Siemens FM 350-1 is a single-channel, high-speed counter module for the SIMATIC S7-300 PLC family, designed to capture pulses from incremental encoders, pulse encoders, or pulse/direction sources. The module plugs into the S7-300 backplane for central use, or it can be deployed distributed on PROFIBUS/PROFINET through an IM 153-1, IM 153-2, or IM 153-4 PN interface module. Centralized operation is the configuration most often confused when a 5 V encoder will not count, because the wrong backplane-side submodule type silently disables the RS422 inputs.

The module exists in four hardware releases. Use the highest firmware revision that matches your STEP 7 V5.x configuration package:

Order Number Firmware Notes
6ES7350-1AH00-0AE0 1 Initial release
6ES7350-1AH01-0AE0 2 Functional update, expanded diagnostic interrupts
6ES7350-1AH02-0AE0 3 Extended comparison functions
6ES7350-1AH03-0AE0 3 Current preferred type

Refer to the FM 350-1 Operating Instructions (Siemens manual, PDF) for the full hardware specification, terminal diagrams, and approved encoder list.

Key electrical and counting limits:

Parameter Value
Counter channels 1
Counter width 32 bits (0 to 4,294,967,295 unsigned; -2,147,483,648 to +2,147,483,647 signed)
Max input frequency, 5 V / RS422 with HW gate 500 kHz
Max input frequency, 5 V / RS422 with SW gate 25 kHz
Max input frequency, 24 V with HW gate 200 kHz
Max input frequency, 24 V with SW gate 10 kHz
Encoder supply, X2 (5 V output) 5.2 VDC +/- 2%, max. 300 mA
Encoder supply, X1 (24 V) External 24 V applied to 1L / 1M
Digital outputs DO0 / DO1 24 V, 0.5 A, short-circuit-proof, isolated
Comparison setpoints 2 (independent DOP_CNT, DON_CNT)
Operating modes Continuous, single, periodic counting
Diagnostic interrupts Wire break, signal loss, 24 V missing, hardware fault

The 5 V Encoder Counting Failure: Root Cause Analysis

When a 5 V incremental encoder is wired to a module that was configured in HW Config for a 24 V encoder, the FM 350-1 routes its input hardware to the X1 24 V front connector and ignores the X2 RS422 inputs. The 5 V differential signals sitting on X2 pins 3 to 8 are never sampled, even though the cables are physically correct. The counter does not advance, no error is raised, and STS_GATE in UDT 1 remains in its last state, which is the symptom most often misdiagnosed as a software or FC problem.

The two connectors on the FM 350-1 are mutually exclusive in HW Config. A single submodule must be selected that matches the physical wiring:

  • X1 (20-pin Phoenix): 24 V single-ended signals. Pin 1 = 1L (24 V), pin 2 = 1M (0 V), pins 3 to 5 = A, B, N inputs (24 V), pin 6 = HW gate, pins 7 to 8 = DO0, DO1 outputs.
  • X2 (15-pin Sub-D female): 5 V RS422 differential signals. Pin 1 = 5 V supply, pin 2 = 0 V, pins 3 to 8 = A+, A-, B+, B-, N+, N-, pins 9 to 10 = HW gate + and -.

The user-side observation "the 5 V encoder does not count, but the 24 V test signal does" is therefore almost always one of three conditions:

  1. HW Config still has the 24 V incremental encoder submodule (or the 24 V pulse/direction submodule) assigned to slot 1 of the FM 350-1. The 5 V signals on X2 are masked by the input mux.
  2. The encoder is wired to X1 instead of X2, or A and B are connected single-ended instead of as a differential pair.
  3. The encoder supply jumper has not been set, so the 5 V output on X2 pin 1 is off and the encoder is unpowered (no signal at all on A+/A-).
Design rule: The FM 350-1 supplies 5 V to the encoder only on X2 pin 1. If you select the 5 V submodule in HW Config and wire the encoder to X2, no external 5 V supply is needed and current draw must not exceed 300 mA. If you select the 24 V submodule, the module does not source encoder power; 24 V must be wired to X1 pin 1 (1L) and 0 V to X1 pin 2 (1M) from an external PSU.

Encoder Signal Types and FM 350-1 Submodule Mapping

STEP 7 exposes the following submodule options under the FM 350-1 in HW Config (Properties > Submodules > Insert Submodule):

Submodule Type (HW Config) Connector Signal Standard Max Frequency (HW gate)
Counting, 24 V Incremental Encoder X1 24 V single-ended (A, B, N) 200 kHz
Counting, 24 V Pulse and Direction X1 24 V single-ended (pulse + direction) 200 kHz
Counting, 5 V Incremental Encoder X2 RS422 differential (A+/A-, B+/B-, N+/N-) 500 kHz
Counting, 5 V Pulse and Direction X2 RS422 differential 500 kHz

For an incremental 5 V encoder with two tracks (A, B) and an optional zero mark (N), select "Counting, 5 V Incremental Encoder." This is the most common configuration for a 5000-pulse, line-driver (RS422) rotary encoder. For a 5 V pulse/direction source (step/dir from a stepper indexer, for example), use "Counting, 5 V Pulse and Direction." Mixing a 5 V line-driver encoder with a 24 V submodule will never produce counts because the input thresholds are not met.

Configuring the Correct Submodule in HW Config

Follow this procedure in SIMATIC Manager with the FM 350-1 configuration package installed (the package is part of the FM 350-1 Getting Started CD or downloadable from Siemens Support):

  1. Open the S7 project in SIMATIC Manager and double-click the S7-300 station to open HW Config.
  2. Locate the FM 350-1 in the configured rack. If the module is missing, browse the catalog under SIMATIC 300 > FM-300 and drag the FM 350-1 (6ES7350-1AH03-0AE0) into the target slot.
  3. Double-click the FM 350-1 to open its Properties dialog. Switch to the "Submodules" tab.
  4. Slot 1 is shown empty by default. Click "Insert" and choose Counting, 5 V Incremental Encoder from the list. Click OK.
  5. Click "Addresses" to confirm the input/output address range. The default is 256 to 271 (16 bytes), but the address may be remapped to fit the I/O layout.
  6. Open the submodule properties and set the operating mode (Continuous, Single, or Periodic) under the "Basic" tab. Set the count range (Unsigned 0 to 4,294,967,295 or Signed -2,147,483,648 to +2,147,483,647) on the "Count" tab.
  7. Click "Save and Compile" (Ctrl+S), then download HW Config to the CPU (PLC > Download).
Configuration must match the wiring. If the 5 V submodule is selected but the encoder is still wired to X1, the inputs are read from X1 and the 5 V signals on X2 are ignored. The reverse is also true: a 24 V submodule with a 5 V encoder on X2 produces no counts. There is no automatic detection.

X2 Connector Wiring for 5 V / RS422 Encoders

Wire the line-driver encoder directly to the 15-pin Sub-D connector on the FM 350-1 front panel. The connector ships with the FM 350-1 and accepts standard Sub-D hoods (shielded hood recommended for noisy industrial environments). Pin assignments per the operating instructions:

X2 Pin Signal Function
1 5 V supply 5.2 VDC output, 300 mA max, internally generated
2 0 V Return for encoder supply
3 A+ Track A positive (RS422)
4 A- Track A negative (RS422)
5 B+ Track B positive (RS422)
6 B- Track B negative (RS422)
7 N+ Zero mark positive (RS422)
8 N- Zero mark negative (RS422)
9 HW gate + Hardware gate, differential positive
10 HW gate - Hardware gate, differential negative
11 to 15 n.c. Reserved, do not connect

Termination is built into the FM 350-1 (220 ohm between A+/A-, B+/B-, N+/N-). Do not add external termination resistors; double termination degrades the differential eye diagram at high frequency. Cable shield must be bonded to the Sub-D metal hood and to a grounded panel at one end only, typically at the cabinet entry.

Encoder supply current budget: a typical 5 V incremental encoder draws 80 to 150 mA. Two encoders (one on each FM 350-1, or daisy-chained) will exceed 300 mA and must use an external 5 V supply, with the encoder power pin (X2 pin 1) left unconnected.

X1 Connector Wiring for 24 V Encoders

For completeness, X1 carries the 24 V signals and is used only when the 24 V submodule is selected in HW Config. Pin assignments:

X1 Pin Signal Function
1 1L 24 V supply for inputs and outputs
2 1M 0 V return for 1L
3 A Track A 24 V input (PNP)
4 B Track B 24 V input (PNP)
5 N Zero mark 24 V input
6 HW gate Hardware gate 24 V input
7 DO0 Digital output 0 (24 V, 0.5 A)
8 DO1 Digital output 1 (24 V, 0.5 A)
9 24 V DO 24 V supply for DO0/DO1
10 0 V DO 0 V return for DO0/DO1
11 to 20 n.c. Reserved

Input threshold (high) is 11 V minimum; low is 5 V maximum. Encoder outputs that swing only 5 V (open-collector with pull-up to 5 V) will not register on X1. If the encoder has only 5 V outputs and X1 must be used, add a level shifter (24 V pull-up on the open-collector output) and a 24 V power supply to the encoder externally.

FC Programming in STEP 7 V5.3

The FM 350-1 ships with a STEP 7 library (commonly named FM3501LIB or, in some installations, FMx50LIB) that provides the data interface between the CPU and the FM. The main function is named FC CNT_CTL1 and is normally FC 1 in the library; in some installations the function appears as FC 2 because of local library numbering, but the call interface is identical. FC CNT_CTL1 is called once per scan in OB 1 (or in a time-of-day interrupt for very high throughput) and exchanges the entire UDT 1 image with the FM.

Call signature (FBD representation in OB 1):

DB_NO   := DB_CNT (data block of type UDT 1)
I_NO    := 256   (I/O start address from HW Config)
SW_GATE := M0.0  (software gate, 1 = enable counting)
SET_DO0 := M0.1  (set output 0, pulse-triggered)
SET_DO1 := M0.2  (set output 1)
GATE_STP:= M0.3  (gate stop, 1 = close gate)
STS_C_UP:= M10.0 (status: counted up)
STS_C_DN:= M10.1 (status: counted down)
STS_GATE:= M10.2 (status: gate open)
STS_DO0 := M10.3 (status: output 0 active)
STS_DO1 := M10.4 (status: output 1 active)
ERR     := M11.0 (group error)
ERR_ID  := MW12  (16-bit error code)

Complete OB 1 call in FBD/ST notation:

CALL "CNT_CTL1"   // or FC 2 in some libraries
     DB_NO   := DB_CNT
     I_NO    := 256
     SW_GATE := "DB_CNT".SW_GATE_OP
     SET_DO0 := "DB_CNT".DO0_SET
     SET_DO1 := "DB_CNT".DO1_SET
     GATE_STP:= "DB_CNT".GATE_STOP
     STS_C_UP:= "DB_CNT".STS_C_UP
     STS_C_DN:= "DB_CNT".STS_C_DN
     STS_GATE:= "DB_CNT".STS_GATE
     STS_DO0 := "DB_CNT".STS_DO0
     STS_DO1 := "DB_CNT".STS_DO1
     ERR     := "DB_CNT".ERR
     ERR_ID  := "DB_CNT".ERR_ID

DB_CNT must be a data block generated from UDT 1 (right-click > New Data Block > Type: UDT 1). Place one global DB per FM 350-1 instance. The FC reads the control bits from the DB, writes the status bits back, and performs the DP/PROFIBUS or backplane handshake with the FM hardware.

To start counting, set SW_GATE := 1 in the DB. The FM will only accept pulses while SW_GATE is high (or while the HW gate on X2 pin 9/10 is active, if the HW gate is enabled in the submodule properties). Pulling SW_GATE back to 0 stops the counter without resetting the value.

UDT 1 Data Structure and I/O Addressing

UDT 1 is the structured data image exchanged between the CPU and the FM 350-1. The full structure (as installed by the FM 350-1 configuration package) is shown below; reserved fields are not used by the application program.

Symbol Type Direction Function
ACT_CNT BOOL CPU → FM 1 = activate counter (start HW-side counting on positive edge of SW_GATE)
LATCH_LOAD BOOL CPU → FM 1 = transfer current count into STS_LATCH
SET_CNT BOOL CPU → FM 1 = load LOAD_VAL into the counter
LOAD_VAL DINT CPU → FM Value loaded by SET_CNT
DOP_CNT DINT CPU → FM Comparison value 0
DON_CNT DINT CPU → FM Comparison value 1
DOP_PAR BOOL CPU → FM Comparison 0 pulse/level behavior
DON_PAR BOOL CPU → FM Comparison 1 pulse/level behavior
ACT_DO0 / ACT_DO1 BOOL CPU → FM Activate output 0 / 1
C_DOP / C_DON DINT FM → CPU Current comparison 0 / 1 status value
DOP_STS / DON_STS BOOL FM → CPU Comparison 0 / 1 reached
STS_GATE BOOL FM → CPU 1 = internal gate is open
STS_C_UP BOOL FM → CPU 1 = counted up since last reset
STS_C_DN BOOL FM → CPU 1 = counted down since last reset
STS_C_Z BOOL FM → CPU 1 = zero crossing detected
STS_LATCH DINT FM → CPU Latched counter value
STS_DO0 / STS_DO1 BOOL FM → CPU Output 0 / 1 current state
ERR BOOL FM → CPU 1 = group error
ERR_ID WORD FM → CPU Error code (see fault table below)

The I/O address set in HW Config (default 256 to 271) is passed to FC CNT_CTL1 via the I_NO parameter. The FC performs the PEB (peripheral exchange) to the FM and back; the CPU program does not need to read or write to the I area directly.

Operating Modes: Continuous, Single, Periodic

The submodule properties in HW Config expose three operating modes. The mode determines how the counter behaves when the upper or lower count limit is reached.

Mode Behavior at Limit Typical Use
Continuous counting (no end value) Counter rolls over (32-bit wrap), no interrupt Free-running position, length measurement
Single counting with end value On reaching end value, gate is closed and counting stops Fixed-length cut-to-length, one-shot dosing
Periodic counting with end value On reaching end value, counter reloads LOAD_VAL and continues Repeat-position, index table, oscillating axis

End value is set in the submodule properties or written to LOAD_VAL. The HW gate on X2 pins 9/10 is enabled per-mode in the same dialog; when enabled, both SW_GATE and the HW gate must be active for the FM to count.

Count Direction: A and B Phase Relationship

For incremental encoders (5 V or 24 V), the count direction is determined by the phase relationship between A and B:

A leads B (A before B on rising edge) B leads A (B before A on rising edge)
Counter increments (counts up) Counter decrements (counts down)
STS_C_UP := 1 STS_C_DN := 1

If the physical rotation direction of the encoder shaft produces the "wrong" count direction in the PLC, swap the A+ and A- wires (or B+ and B-) at the X2 connector. Do not invert in software; the FM determines direction at the input hardware level and software inversion causes position-lag errors. Verify with the online monitor in STEP 7: turn the encoder shaft slowly clockwise, watch UDT 1 field STS_C_UP and the load value in the DB.

Verification, Diagnostics, and Error Codes

After changing the submodule, downloading HW Config, and powering the encoder, verify with this checklist:

  1. Open the DB_CNT instance in STEP 7 Monitor/Modify. Confirm SW_GATE := TRUE, STS_GATE := 1 within one OB 1 cycle.
  2. Turn the encoder shaft by hand at less than 1 rev/sec. Confirm the load value (UDT 1 counter) increments on each A/B pulse and STS_C_UP pulses with each rotation.
  3. Reverse the shaft. STS_C_DN should pulse and the load value should decrement.
  4. Trigger a diagnostic interrupt test by disconnecting X2 pin 3 (A+) while SW_GATE is high. The FM should raise a diagnostic interrupt and set ERR := 1, with ERR_ID indicating wire break on Track A.
  5. Check the FM LED indicators on the front panel: SF (red) for group fault, BF (red) for bus fault (distributed mode only), and the channel status LED (green) for active counting.

Common error codes returned in ERR_ID (UDT 1):

ERR_ID (hex) Meaning Remedy
0001H Parameter assignment error Check HW Config submodule selection matches wiring
0002H Encoder wire break (signal A or B missing) Inspect X2 pins 3 to 6, confirm differential pair integrity
0004H Zero mark wire break Inspect X2 pins 7 to 8, only if zero mark is enabled
0008H 5 V encoder supply overloaded Reduce encoder current, move to external 5 V supply
0010H 24 V supply missing on X1 Apply 24 V to 1L/1M (only relevant for 24 V submodule)
0020H Gate error (HW and SW gate conflict) Verify HW gate polarity on X2 pins 9/10
0040H End value out of range Reduce LOAD_VAL to within counter range
0080H Communication error to FM Check I/O address, bus connector, firmware compatibility
0100H Comparison value error DOP_CNT or DON_CNT outside counter range
0200H Watchdog timeout FM firmware/hardware fault, replace module if persistent

Diagnostic interrupts are enabled in HW Config under the submodule "Diagnostics" tab. When enabled, OB 82 is called and the diagnostic information is available in the OB 82 local variables. The SFC 51 (SZL) read of SSL 0x00A2 returns the standard diagnostic record for the FM.

Field note: If the FM 350-1 has been in service for years and a 5 V encoder is added to a previously 24 V-configured module, the most common commissioning error is leaving the 24 V submodule in place. Always recompile HW Config and download the new configuration before debugging the encoder wiring. The 5 V submodule must be downloaded, not just edited in HW Config.

Frequently Asked Questions

Why does my 5 V encoder not increment the FM 350-1 counter while a 24 V test signal does count?

The FM 350-1 only reads from the X2 RS422 inputs when the HW Config submodule is set to "Counting, 5 V Incremental Encoder" (or 5 V Pulse/Direction). If the submodule is still set to 24 V, the module reads X1 and ignores X2. Open HW Config, double-click the FM 350-1, go to Submodules, insert the 5 V type, and re-download.

Do I have to power the 5 V encoder separately, or does the FM 350-1 supply it?

The FM 350-1 supplies 5.2 VDC at up to 300 mA on X2 pin 1, internally regulated. Wire the encoder supply to X2 pin 1 (5 V) and pin 2 (0 V). If the encoder draws more than 300 mA, use an external 5 V supply and leave X2 pin 1 unconnected.

What is the difference between FC 1 (CNT_CTL1) and FC 2 in the FM 350-1 library?

FC CNT_CTL1 is the standard function in the FM 350-1 library and is called once per scan in OB 1 to exchange UDT 1 with the FM. In some installations, the function is renumbered and appears as FC 2; the call interface is identical. Do not use the FM 350-2 library FC 2 (CNT2_CTR) with the FM 350-1; the data structures are different.

How do I get the FM 350-1 to count up in direction A and count down in direction B?

For an incremental encoder, the count direction is determined by the A/B phase relationship. A leads B on the rising edge of A means count up (STS_C_UP set); B leads A means count down (STS_C_DN set). If your rotation produces the wrong direction, swap the A+ and A- (or B+ and B-) wires at X2. Do not invert in software.

Can the FM 350-1 run with STEP 7 V5.3 and an older FM configuration package?

Yes. STEP 7 V5.3 and later ship with the FM 350-1 configuration package. If the package is missing, the module appears as an unrecognized part in HW Config and FC CNT_CTL1 cannot be installed. Reinstall the FM 350-1 Getting Started CD or download the latest configuration package from Siemens Support entry 1086726 to restore the library and GSD files.

Back to blog