Changing ET200MP AQ4 Channel Type Online via WRREC on S7-1500

David Krause13 min read
I/O ModulesSiemensTutorial / How-to
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

1. Problem Overview

An S7-1500 CPU controlling a continuous process needs to reconfigure an analog output channel on a remote ET 200MP station without taking the CPU out of RUN. Specifically, the application must switch one or more channels of an AQ 4xU/I ST module (Siemens article number 6ES7532-5HD00-0AB0) from the voltage range 0…10 V to the current range 4…20 mA while the plant is live. Because the standard "Download to device" workflow for hardware configuration forces the CPU to STOP on a stand-alone S7-1500, a different mechanism is required: the user must write the new parameter assignment directly to the module at runtime using the WRREC instruction and the module's parameter data record 128.

The same mechanism applies to ET 200MP AI modules when enabling additional diagnostics such as the Quality Information (QI) bit on each channel of the AI 8xU/I/RTD/TC ST (6ES7531-7KF00-0AB0). All analog input and output parameter sets in the ET 200MP family can be reassigned in RUN through record-based writes; the CPU never has to leave RUN mode.

Key constraint: Parameters written via WRREC are volatile: they remain valid until the next power cycle or station restart. The values stored in the STEP 7 hardware configuration (the offline project) are reloaded at the next restart. For permanent changes, update the STEP 7 project after the runtime change succeeds and perform the next hardware download during a planned maintenance window.

2. Module Identification and Prerequisites

Confirm the exact hardware before writing any record. The source application contains:

Position Module Article Number Firmware Slot Width
CPU S7-1500 (e.g., CPU 1515-2 PN) 6ES7515-2AM02-0AB0 or similar ≥ V2.0 -
IM 155-5 PN ST (head) ET 200MP PN interface module 6ES7155-5AA00-0AB0 ≥ V4.2 -
Slot 1…2 DI 32x24VDC HF 6ES7521-1BL00-0AB0 - 35 mm
Slot 3 DQ 32x24VDC/0.5A HF 6ES7522-1BL00-0AB0 - 35 mm
Slot 4…5 AI 8xU/I/RTD/TC ST 6ES7531-7KF00-0AB0 - 35 mm
Slot 6 AQ 4xU/I ST 6ES7532-5HD00-0AB0 - 35 mm

Check the firmware of the IM 155-5 PN ST and of the AQ module. The WRREC runtime parameter write is supported by all ET 200MP analog modules with firmware ≥ V1.0 and is documented in the SIMATIC ET 200MP Manual Collection.

Required tools and libraries:

  • TIA Portal V16 or later (V17 recommended for firmware ≥ V4.2 modules).
  • STEP 7 Professional or TIA Portal Basic with the S7-1500 hardware support package installed.
  • The WRREC instruction (built-in, no library required) or SFB53 in legacy blocks.
  • For PLCSIM testing: PLCSIM V18 or PLCSIM Advanced ≥ V3.0.
  • Online access to the S7-1500 over PROFINET (the same network used by the ET 200MP station).

3. How Siemens ET 200MP Handles Online Parameter Changes

ET 200MP analog I/O modules store their channel parameters in record 128. There are two ways for the CPU to push a parameter set into a module:

  1. Project download (HW Config): When the project is compiled and downloaded, the engineering station writes record 128 to the module during the connection establishment. This is what triggers the STOP transition on an S7-1500 with a stand-alone (non-redundant) CPU.
  2. Runtime write via WRREC: The user program issues a write to record 128 at any time. The module validates the record, applies it on the fly, and reports the result back through the STATUS, DONE, and ERROR outputs of the instruction. The CPU stays in RUN.

Both paths use the same byte layout. The runtime path simply decouples the write from the project download. This is exactly the same mechanism that engineering tools such as the TIA Portal "Assign PROFINET device name" or "Online > Parameter assignment of modules" use internally when "Apply in RUN" is selected.

For redundant S7-1500R/H systems, a project download can be made in RUN through the system redundancy logic. On a stand-alone S7-1500 (as in this case), WRREC is the only path that avoids a CPU STOP.

4. WRREC Instruction Reference

On the S7-1500, WRREC is available as a multi-instance-capable instruction under Instructions > Basic Instructions > Extended instructions > Distributed I/O > WRREC. Its formal interface:

Parameter Direction Type Meaning
REQ Input Bool Edge-triggered write request.
ID (formerly LADDR on S7-300/400) Input HW_IO Hardware identifier of the module head (PROFINET device or submodule slot).
INDEX (formerly RECNUM) Input DInt Data record number. Use 128 for analog I/O parameter assignment.
LEN Input UDInt Length of the data record to be written (bytes).
DONE Output Bool Write completed successfully.
BUSY Output Bool Write still in progress.
ERROR Output Bool An error occurred.
STATUS Output Word Call / module status (see Section 7).
RECORD InOut Variant Pointer to the data record buffer.

The hardware identifier for the slot is found in TIA Portal under Devices & networks > ET 200MP > AQ 4xU/I ST > Properties > System constants. The value is typically of the form 268...272 for slot 6 of head module 0. Always use the symbolic constant from the project (for example, "AQ4xUI_1") so that the program survives hardware re-numbering.

5. Data Record 128 Structure for AQ 4xU/I ST

Record 128 for the AQ 4xU/I ST follows the standard Siemens parameter record layout documented on page 2466 (parameter record header) and the channel-parameter definitions on page 2670 of the SIMATIC ET 200MP Manual Collection. The complete layout for the four-channel parameter set is:

Byte offset Length Content
0…1 2 Header (number of parameter records, format ID, length spec per the manual).
2…5 4 Parameter record for channel 0.
6…9 4 Parameter record for channel 1.
10…13 4 Parameter record for channel 2.
14…17 4 Parameter record for channel 3.
18 1 Diagnostics enable / behavior of substitute values.

Header (bytes 0…1): These bytes define the layout of the parameter record. The most common values used by ET 200MP analog modules are:

  • Byte 0 = 16#00 — reserved/format identifier (parameter record, channel-oriented).
  • Byte 1 = 16#10 — length spec (16 parameter data bytes follow the header, covering 4 channels of 4 bytes each).

Refer to page 2466 of the manual for the exact bit-level definition. The values above match the structure that the project download uses for the same module and are therefore accepted by the module at runtime.

Channel parameter record (each 4 bytes):

Bit / Byte Meaning Example value for 4…20 mA
Bit 0 Output type: 0 = Voltage, 1 = Current 1
Bit 1…2 Range selection 10 = 4…20 mA, 11 = 0…20 mA, 01 = ±20 mA (current branch)
Bit 3 Diagnostics: wire break (current only) 1
Bit 4 Diagnostics: short circuit (voltage only) 0
Bits 5…7 Reserved 0
Bytes 1…3 Channel-specific override / substitute value setup 16#00 16#00 16#00 (no override, use last valid value on STOP)

For example, switching channel 0 from 0…10 V to 4…20 mA with wire-break diagnostics enabled produces the byte 16#0B = 0000 1011b (current, 4…20 mA, wire-break enable). Channels that remain at 0…10 V keep 16#00.

6. Step-by-Step Implementation

  1. Identify the HW identifier. Open the ET 200MP device in TIA Portal, select the AQ 4xU/I ST slot, switch to Properties > System constants, and copy the symbolic name (e.g. Local~AQ4xUI~HEAD or the numeric value).
  2. Declare a global DB for the parameter record. Create a data block DB_AQ_Params with an array of bytes of length 19. Mark the array with the {S7_string = '...'} attribute or use a PLC data type so that the byte order is consistent at compile time.
  3. Initialize the header. Pre-load bytes 0 and 1 with 16#00 and 16#10 in the startup OB or in the first scan of OB1.
  4. Build the per-channel parameter bytes. For each channel, set the byte value matching the desired output type and range. Leave substitute-value bytes at 16#00 unless the application needs specific STOP-state behavior.
  5. Trigger the write. Use a one-shot edge of a boolean tag (for example, "cmdApplyAQRange") to start the WRREC call. Pass the data block slice as the RECORD parameter and 19 as LEN.
  6. Monitor the result. Evaluate DONE, ERROR, and STATUS. Store the STATUS word in a diagnostics tag so that any rejection can be analyzed in HMI or in the TIA Portal watch table.
  7. Re-arm the trigger. Reset the trigger tag once BUSY goes low.
  8. Validate the output. Read back record 128 with RDREC if the application needs confirmation; otherwise, monitor the analog value in the I/O image.

7. Sample SCL Implementation

The following SCL block demonstrates a complete WRREC wrapper that builds the parameter record and writes it in RUN. Save as FB_AQ_RangeSwitch in the S7-1500 program and call it from OB1 or from an HMI-triggered FC.

FUNCTION_BLOCK "FB_AQ_RangeSwitch"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
   VAR_INPUT
      i_hwAq        : HW_IO;          // HW identifier of the AQ slot
      i_doSwitchCh0 : BOOL;           // TRUE = force ch0 to 4..20 mA
      i_doSwitchCh1 : BOOL;
      i_doSwitchCh2 : BOOL;
      i_doSwitchCh3 : BOOL;
      i_trigger     : BOOL;           // edge-triggered
   END_VAR
   VAR_OUTPUT
      o_busy        : BOOL;
      o_done        : BOOL;
      o_error       : BOOL;
      o_status      : WORD;
   END_VAR
   VAR
      s_aqRecord    : ARRAY[0..18] OF BYTE;
      s_re          : R_TRIG;
      s_wrec        : WRREC;
      s_len         : UDINT := 19;
   END_VAR

BEGIN
   // Header bytes 0..1 (see manual page 2466 of ET 200MP Manual Collection)
   s_aqRecord[0] := 16#00;
   s_aqRecord[1] := 16#10;

   // Channels 0..3: bit pattern 0000 1011 = 16#0B (current, 4..20 mA, wire-break enabled)
   // Voltage / no change = 16#00
   s_aqRecord[2]  := SEL(i_doSwitchCh0 := i_doSwitchCh0, IN0 := 16#00, IN1 := 16#0B);
   s_aqRecord[6]  := SEL(i_doSwitchCh1 := i_doSwitchCh1, IN0 := 16#00, IN1 := 16#0B);
   s_aqRecord[10] := SEL(i_doSwitchCh2 := i_doSwitchCh2, IN0 := 16#00, IN1 := 16#0B);
   s_aqRecord[14] := SEL(i_doSwitchCh3 := i_doSwitchCh3, IN0 := 16#00, IN1 := 16#0B);

   // Bytes 3..5, 7..9, 11..13, 15..17 are per-channel options; leave at 0 for default
   // Byte 18 = module-wide diagnostics / substitute behavior; leave at 16#00
   FOR #i := 0 TO 18 DO
       IF (#i = 3) OR (#i = 4) OR (#i = 5) OR
          (#i = 7) OR (#i = 8) OR (#i = 9) OR
          (#i = 11) OR (#i = 12) OR (#i = 13) OR
          (#i = 15) OR (#i = 16) OR (#i = 17) OR (#i = 18) THEN
          // (left as 16#00 for default behavior)
       END_IF;
   END_FOR;

   s_re(CLK := i_trigger);
   s_wrec(REQ    := s_re.Q,
          ID     := i_hwAq,
          INDEX  := 128,
          LEN    := s_len,
          DONE   => o_done,
          BUSY   => o_busy,
          ERROR  => o_error,
          STATUS => o_status,
          RECORD := s_aqRecord);
END_FUNCTION_BLOCK
The exact byte layout (channel order, reserved bits, optional fields) is module-specific. Always confirm against the parameter record chapter of the relevant module in the ET 200MP Manual Collection before relying on the example above in production.

8. Verification and Status Codes

After the WRREC call returns, check the result in the following priority order:

  1. DONE = 1, ERROR = 0 — write accepted; the module has switched the channel type. Re-read the analog value to confirm scaling.
  2. ERROR = 1 — the STATUS word contains the error code. Typical STATUS values for analog I/O modules:
STATUS (hex) Meaning Remedy
0000 No error. -
7000 No active request. Trigger again.
7001 First call with REQ=1, write in progress. Wait.
7002 Subsequent call, write in progress. Wait.
80A1 Module does not recognize the record number. Check INDEX = 128.
80A7 Module in firmware update or being commissioned. Wait for end of update.
80A9 Application (e.g. WRREC) not ready, resource busy. Retry.
80B1 Length spec incorrect. Set LEN to actual record length (19 in this case).
80B2 Configured slot empty or address invalid. Verify HW identifier.
80C3 Resources (memory) occupied. Retry after other jobs complete.
80D0 / 80D1 / 80D2 Header / parameter number / parameter value error. Recompute bytes 0..1 header and per-channel bytes; consult manual page 2466.
80FF Internal module error. Re-seat the module or check diagnostics buffer.
DF80…DFFF Vendor/module-specific error in the lower byte. Decode lower byte; see module manual diagnostics section.

Additional verification on the S7-1500 side:

  • Watch table: Insert the module's HW identifier and the parameter DB. After triggering WRREC, force the trigger and observe DONE / ERROR / STATUS.
  • Online & Diagnostics: Open the AQ module's online view and inspect the diagnostic buffer. A successful write appends an entry of type “Parameter assignment”.
  • Process value check: Read the analog output value (in the I/O image or via RDREC) and confirm it is in the new engineering units.

9. PLCSIM Testing and Field Commissioning

WRREC works inside PLCSIM with the following caveats:

  • PLCSIM V18 and newer fully simulate the ET 200MP station including PROFINET. The runtime parameter write to record 128 of an analog module is recognized and reflected in the simulation.
  • PLCSIM Advanced (separate installer) is required to simulate an entire ET 200MP head with multiple slots at full speed, especially when the test program uses PROFINET IO updates.
  • The HW identifier used inside the simulation must match the identifier that the simulated ET 200MP station exposes. TIA Portal automatically generates the matching identifiers when the project is loaded into the simulated controller.
  • PLCSIM does not generate real analog currents; verify only the parameter-record round-trip (write » status » read-back) and the resulting value-in-process-image scaling.

Field commissioning checklist:

  1. Back up the current project and note the existing parameter set for each channel.
  2. Drive the affected output to a safe value (e.g., 4 mA or 0 mA) before switching range to avoid a transient that could damage the field device.
  3. Manually drive the current/voltage at the field terminals with a multimeter to verify the new range after the write completes.
  4. Update the STEP 7 hardware configuration to match the new range so that the next project download does not revert the change.
  5. Document the runtime change in the plant log: tag, timestamp, status result, operator.

10. Extending the Method to AI 8xU/I/RTD/TC ST

The same WRREC technique applies to the AI 8xU/I/RTD/TC ST when activating the Quality Information (QI) bit per channel. The parameter record for AI modules also uses record 128. With the QI bit enabled, the value status returned in the I/O image reflects validity (good / bad / substitute). This is useful when the process requires explicit bad-quality handling (for example, voting of redundant signals, or interlock logic that must not run on a failed transmitter).

Enabling QI on an AI module also turns on the corresponding value-status bits in the process image. Any downstream code that previously ignored these bits must be reviewed to avoid unexpected behavior after the change.

11. Frequently Asked Questions

Will writing record 128 with WRREC always keep the S7-1500 in RUN?

Yes, on a stand-alone S7-1500 the CPU stays in RUN throughout the WRREC execution. The parameter write goes directly to the ET 200MP head and does not initiate a project download, so no operating-mode transition is triggered.

Is the parameter change made via WRREC permanent?

No. The change is volatile: it remains active until the next station restart, CPU power cycle, or project download that includes the slot. For a permanent change, update the STEP 7 hardware configuration to match and re-download during the next planned outage.

What does WRREC return with STATUS = 80D0?

STATUS 80D0 means the module rejected the parameter header. Check bytes 0 and 1 of record 128 against the layout in the ET 200MP Manual Collection page 2466. Common mistakes are swapping header/format identifier values or using the wrong length spec.

Can I change several analog channels in a single WRREC call?

Yes. The parameter record 128 contains one block per channel, so all four AQ channels (or all eight AI channels) are updated in a single write. This is preferred over per-channel writes because it reduces the number of PROFINET acyclic transactions.

Does this method also work in PLCSIM?

Yes, with PLCSIM V18 or PLCSIM Advanced V3 and newer. The simulated ET 200MP head processes record 128 the same way as the real hardware, so the full parameter round-trip (WRREC, STATUS, RDREC) can be validated before going to the field.

Where do I find the correct hardware identifier for the AQ slot?

In TIA Portal, open Devices & Networks, select the ET 200MP head, click the AQ 4xU/I ST slot, and read the value under Properties > System constants. Use the symbolic name (for example Local~AQ4xUI~HEAD) rather than the numeric identifier so that the program survives hardware re-numbering.

Back to blog