1. Overview
Driving a variable frequency drive (VFD) speed reference from a Siemens SIMATIC S7-1200 CPU through a SIMATIC HMI panel is one of the most common lab, training, and machine-building tasks. The application pattern is straightforward: an operator enters a target speed in hertz (Hz) on the HMI, the value is written to a PLC tag, the CPU converts that engineering value into the S7-1200 analog-output raw format, and the analog-output module generates a proportional 0–10 V or 4–20 mA signal that the VFD interprets as its speed reference.
Two functional paths are used in practice:
- Direct HMI-to-AO binding: the HMI writes the scaled integer (0–27648) directly to the analog-output peripheral word using an I/O Field whose process tag is the %QW address of the AO channel.
- PLC-side scaling path: the HMI writes an engineering value (e.g., 0.0–50.0 Hz) to a data block tag, and the CPU program applies the NORM_X and SCALE_X instructions (or the legacy NORM and SCALE blocks) to convert the value to the 0–27648 raw count and move it to the AO word.
The first method is faster to commission and is acceptable for a class project, bench test, or a small machine with a single VFD. The second method is the recommended industrial pattern because it centralizes scaling, makes the engineering unit (Hz) the single source of truth, and survives HMI screen rebuilds without re-binding peripheral addresses.
2. Prerequisites
Verify the following hardware and software items before configuring the application. The component catalog numbers and TIA Portal versions are those most commonly encountered in a college lab or first-year machine build; substitute equivalents from the same family if your inventory differs.
| Item | Catalog / Version | Purpose |
|---|---|---|
| S7-1200 CPU with analog output | 6ES7214-1AE30-0XB0 (CPU 1214C DC/DC/DC) with 6ES7232-4HA30-0XB0 SB 1232 signal board, or 6ES7232-4HB32-0XB0 SM 1232 module | Holds ladder logic, exposes %QW analog output word |
| TIA Portal | V16, V17, or V18 (any of these supports NORM_X/SCALE_X) | Project engineering for PLC and HMI |
| SIMATIC HMI | KTP700 Basic, KTP1200 Basic, or Comfort panel (6AV2 family) | Operator entry of speed setpoint |
| VFD | Any 0–10 V or 4–20 mA speed-reference input (SINAMICS V20, V90, G120, or third-party drive) | Receives analog speed reference |
| Wiring | Shielded twisted pair, 24 VDC supply, common 0 V between PLC, HMI, and VFD reference terminal | Analog signal integrity |
Confirm in TIA Portal: Device configuration → CPU → Properties → Analog outputs shows the SB 1232 / SM 1232 is detected and the output type is set to Voltage 0–10 V or Current 4–20 mA. The default output type on first insertion is voltage; mismatched configuration between the software setting and the wired load is the single most common cause of "the VFD runs at full speed regardless of the HMI value" reports.
3. Analog Output Scaling Theory (0–27648 Raw Range)
The S7-1200 analog I/O subsystem uses a 12-bit (SB 1232 / SM 1232) or 13/14-bit (some SM modules) right-justified integer, with 0–27648 representing the nominal full scale. Over-range values (27649–32511) are diagnostic values; the SM 1232 modules will output roughly 10.5 V or 21 mA when the raw word exceeds 27648. Never let production code drive the AO into the over-range band unintentionally; clamp the SCALE_X result to 27648 before moving it to %QW.
| Engineering value | Raw word (INT) | Voltage output (0–10 V type) | Current output (4–20 mA type) |
|---|---|---|---|
| 0 % | 0 | 0 V | 4 mA |
| 25 % | 6912 | 2.5 V | 8 mA |
| 50 % | 13824 | 5.0 V | 12 mA |
| 75 % | 20736 | 7.5 V | 16 mA |
| 100 % | 27648 | 10.0 V | 20 mA |
| Over-range | 27649–32511 | ~10.5 V | ~21 mA |
The conversion formulas for a 0–50 Hz application are:
Engineering → Raw (HMI side, integer):
Raw = round(Hz × 27648 / 50) = round(Hz × 552.96)
Raw → Engineering (VFD feedback display):
Hz = Raw × 50 / 27648
The factor 552.96 is exact for 0–50 Hz spans. For other maximum-speed spans (e.g., 0–60 Hz, 0–400 Hz), recompute the factor as 27648 / MaxHz and store it in a clearly named tag (for example f_HMI_to_RAW_SCALE).
4. Method 1 — Direct HMI-to-AO Tag Binding
This method lets the HMI I/O Field write the raw 0–27648 integer straight to the analog-output peripheral word. It is the fastest to set up and is acceptable for a class project or a single-channel bench test.
4.1 PLC side
No logic is required. The analog-output word is mapped automatically by the device configuration. For a CPU 1214C with a single SB 1232 inserted in slot 1, the output word is:
-
SB 1232 AQ1 =
%QW96 -
SB 1232 AQ2 =
%QW98(only present on 2-channel SB)
For an SM 1232 in slot 1 of the signal-module rack, the start address depends on the configuration; confirm it in Device view → module → Properties → I/O addresses. Typical starter projects place AQ1 at %QW112 for the first SM.
4.2 HMI side
- Add an I/O Field from the toolbox onto the HMI screen.
- Set Mode = Input/output.
- Set Display format to a signed decimal that fits the raw range (e.g., five digits, no decimal:
99999). The operator will type values from 0 to 27648 directly. - In the Properties → General → Process tag, click the tag browser and select the PLC tag
%QW96. Promote it if prompted. - Set Limits (optional but recommended): minimum 0, maximum 27648. This prevents the operator from typing a value that drives the VFD above the configured max frequency.
When the operator types 13824, the HMI writes 13824 to %QW96, the SB 1232 outputs 5.0 V, and a properly scaled VFD displays 25 Hz. This is the relationship the field report describes: "HMI tag 0–50 Hz relating to 0–27648."
5. Method 2 — PLC-Side NORM_X / SCALE_X Scaling
This is the industrial-standard pattern. The HMI exchanges a real (floating-point) engineering value, the PLC normalizes it to 0.0–1.0, and scales it to the AO raw range.
5.1 Data block layout
Create a global DB (e.g., DB_HMI) with the following tags:
| Tag | Type | Initial value | Comment |
|---|---|---|---|
| i_SpeedSetpoint_Hz | Real | 0.0 | HMI-written setpoint (0.0–50.0) |
| i_SpeedMax_Hz | Real | 50.0 | Maximum speed in Hz (drive parameter P1082 or equivalent) |
| r_Norm | Real | 0.0 | Intermediate 0.0–1.0 result |
| i_AO_Raw | Int | 0 | 0–27648 raw word for %QW |
| b_Enable | Bool | FALSE | Drive-Ready / Run permissive from VFD |
5.2 STL / SCL logic block
Add the following code to OB1 (SCL form shown; equivalent LAD/FBD using NORM_X and SCALE_X instruction boxes is shown in the comments):
// Normalize Hz setpoint to 0.0–1.0
IF i_SpeedMax_Hz > 0.0 THEN
r_Norm := LIMIT(0.0, i_SpeedSetpoint_Hz / i_SpeedMax_Hz, 1.0);
ELSE
r_Norm := 0.0;
END_IF;
// Scale normalized value to 0–27648 raw count
i_AO_Raw := REAL_TO_INT(r_Norm * 27648.0);
// Drive enable / run permissive
IF b_Enable THEN
"AQ_SpeedRef" := INT_TO_WORD(i_AO_Raw); // move to %QW96 via tag
ELSE
"AQ_SpeedRef" := 16#0000; // 0 V / 4 mA → drive stop
END_IF;
Tag AQ_SpeedRef must be declared as a Word or Int in the PLC tag table and mapped to %QW96 (or whatever AQ address the device configuration reports). The mapping is done in PLC tags → AQ_SpeedRef → Properties → Address; enter the %QW address directly or use the system constant generated for the module.
5.3 HMI I/O Field for the engineering setpoint
- Add an I/O Field on the HMI screen.
- Set Mode = Input/output.
- Set Display format = floating-point with one decimal, e.g.,
999.9. - Bind to the PLC tag
"DB_HMI".i_SpeedSetpoint_Hz. - Set Limits: lower 0.0, upper 50.0. HMI field-level limits prevent the operator from entering 75 Hz on a 50 Hz-configured drive.
- Add a second read-only I/O Field for the current raw count, bound to
"DB_HMI".i_AO_Raw, formatted as an integer. This is a useful commissioning view because it lets you verify the math at a glance.
6. Step-by-Step TIA Portal Configuration
- Insert the analog output hardware. Open Project tree → Devices & networks → CPU_1. Drag the SB 1232 or SM 1232 onto the signal-board slot or signal-module slot. TIA Portal will assign start addresses automatically.
- Configure the output type. Click the module → Properties → Analog outputs → Output type. Choose Voltage 0–10 V for most VFD references. If the drive expects 4–20 mA, choose Current 4–20 mA and ensure the load is a true current loop (the VFD reference terminal provides loop power or accepts a sinking output, depending on the drive).
-
Note the output address. Under I/O addresses, write down the start address. For an SB 1232 in a CPU 1214C, the default is start 96; that is
%QW96. -
Create the data block. Program blocks → Add new block → DB. Name it
DB_HMI, uncheck Optimized block access if you intend to map the AO word via an absolute address. With optimized access, map the tag to %QW using the Address column in the PLC tag table instead. - Add the scaling logic from Section 5.2 to OB1, or to a function block if you prefer a re-usable FC/FB (recommended for multi-axis machines).
- Compile the PLC and download to the CPU.
- Add the HMI in the same project. In Devices & networks, drag a SIMATIC panel (KTP700 Basic is the typical lab panel) onto the HMI rack. Connect the HMI to the PLC PROFINET port and ensure the HMI is assigned to the same subnet as the CPU.
- Configure the HMI connection. The HMI connection wizard will populate the HMI's PLC pointer. Confirm in HMI_1 → Connections that the partner IP matches the CPU and the access point is S7ONLINE.
- Insert the I/O Field per Section 4.2 (Method 1) or Section 5.3 (Method 2).
- Compile and download the HMI. Restart the Runtime on the panel.
7. Wiring the Analog Output to the VFD
Most low-voltage VFDs (SINAMICS V20, V90, G120C, PowerFlex 4, Danfoss VLT, Yaskawa V1000) accept a speed reference on a dedicated analog-input terminal. Refer to the drive's parameter list to set the source of the speed reference (e.g., SINAMICS V20 parameter P1000 = 2 for analog setpoint, P0756 = 0 for 0–10 V on AI1). The reference terminal must share a 0 V with the S7-1200 analog-output common.
| PLC side (SB 1232, voltage type) | VFD side (typical) | Wire |
|---|---|---|
| AQ1 signal | AI+ (reference input) | Twisted pair, conductor A |
| Manu (analog common) | AI– (reference common) | Twisted pair, conductor B |
| Chassis / PE | Chassis / PE | Drain wire / shield |
8. Verification and Commissioning
After download, walk through the following checks before applying the speed reference to a loaded motor:
-
Watch table check (PLC): Open a watch table in TIA Portal online mode. Force
DB_HMI.i_SpeedSetpoint_Hz = 0.0. Confirm the AO raw word reads 0. Set 50.0; confirm the raw word reads 27648. Set 25.0; confirm 13824 (allow ±1 LSB). - HMI binding check: On the HMI, change the I/O Field value. Confirm the value appears in the watch table within one PROFINET cycle (typically 4–32 ms).
- Voltage check (PLC side): With the PLC in Run and the HMI at 50.0 Hz, measure the AO terminals with a multimeter. Expect 10.00 V ±0.05 V. With 25.0 Hz set, expect 5.00 V. If the reading is half (e.g., 5.0 V at 50.0 Hz), the drive's input type is set to 0–5 V, or the drive's jumper is misconfigured.
- Drive-side check: Place the drive in Hand/Auto, set the source to the analog reference, and view the drive's HMI or webserver. The drive should display a frequency proportional to the analog input.
- Spin test (unloaded): With the motor uncoupled or unloaded, ramp the HMI from 0.0 to 5.0 to 25.0 to 50.0 Hz. Watch for smooth ramp, no fault codes, and a stable motor speed. If the drive shows a "no signal" or "4–20 mA loss" fault when the HMI is at 0.0, you are wired to a current loop, not a voltage loop; either reconfigure the AO to current or move the wire to a voltage input on the drive.
9. Troubleshooting Matrix
| Symptom | Likely cause | Resolution |
|---|---|---|
| Drive runs at full speed regardless of HMI value | AO output type mismatch (drive expects 0–5 V; PLC outputs 0–10 V) OR drive parameter P1000/P0756 set to keypad | Verify drive's reference-source parameter is set to analog input. Verify PLC AO type matches drive expectation. |
| Drive does not respond to HMI value at all | Watch table shows raw word is 0 even when HMI displays a value | HMI tag not promoted; check the connection in HMI_1 → Connections and verify the PLC IP in the HMI project matches the CPU. |
| HMI shows dashes or ### in the I/O Field | Display format too small for the value, or tag type mismatch | Increase format width. Verify the tag type is INT for raw binding, REAL for engineering binding. |
| Speed oscillates or jitters | Float-to-INT conversion not clamped, or HMI is writing a different scaled value per scan | Wrap r_Norm in LIMIT(0.0, ..., 1.0) and clamp i_AO_Raw to 0–27648. Add the SCALE_X min/max so values outside the operating window are pinned. |
| AO SF (red) LED on the CPU | Wiring fault, open current loop, or output type conflict | Check for broken wires. Check that the output type in the device configuration matches the wired load. View Online & diagnostics → Diagnostic buffer. |
| Motor runs but reads half the expected speed | Drive configured for 0–5 V input on a 0–10 V output, or ramp parameter is too aggressive | Confirm drive AI type. Increase the drive's ramp-up/ramp-down time (P1120/P1121 on Siemens drives) if the speed reference is otherwise correct. |
| SCALE_X result is off by 1 LSB | Round-off of REAL → INT | Acceptable; ±1 LSB at 12-bit resolution. For tighter results, multiply by 1000 before INT conversion and round. |
10. Alternative Platform Notes
While the S7-1200 is the focus of this guide, the same operator-entered-setpoint pattern is implemented on other small PLC families with platform-specific scaling primitives. The differences are in the tag address space and the raw-range integer.
10.1 AutomationDirect Click PLC
The Click series uses Data Register DF6 as the analog-output value for the CPU's built-in 0–10 V AO. Operators control the AO by writing 0–4095 (12-bit) to DF6. The equivalent HMI pattern is: I/O Field on C-more or clickPLUS HMI → Process Tag = DF6 → Format = integer → Limits 0 to 4095. For engineering-units display, the C-more panel supports scaled numeric tags with user-defined min/max that map directly to 0–4095 internally. Refer to the Click PLC user manual for the exact DF address and the scaling parameters in the C-more tag configuration.
10.2 Unitronics UniLogic / Vision series
UniLogic stores analog-output values in the operand MB n (memory bits/bytes) for the onboard AO. The typical range is 0–4000 for a 0–10 V or 4–20 mA output. In the HMI application editor, the field is configured with Input source = the AO operand, Display = numeric, and Scale configured under the tag's properties. UniLogic also exposes a built-in Simulate function for analog inputs in the project's debug mode, which is useful for verifying scaling math before wiring hardware. Refer to the UniLogic help for the Analog Operand table in the project tree.
11. Field-Proven Patterns and Caveats
- Single source of truth for max speed. Store the maximum Hz as a tag, not a literal in the SCALE_X call. If the drive is later reconfigured to 60 Hz, change one tag and the rest of the program re-scales automatically.
- Clamp before, clamp after. Clamp the HMI input, the normalized result, and the final raw value. Defensive clamping at each boundary prevents the over-range band (27649–32511) from saturating the AO when an operator fat-fingers a number.
- Watch the cycle time. The HMI updates the tag on the configured acquisition cycle (default 1 s for basic panels). If the application requires a faster follow-up (e.g., a jog dial), reduce the acquisition cycle in the HMI tag's properties or use a direct PLC tag rather than an HMI-internal one.
- Drive ramp vs. AO ramp. The PLC writes the AO instantly. The drive's internal ramp (P1120/P1121 on Siemens drives) determines motor acceleration. Do not re-scale the AO on the HMI side to slow the motor — let the drive ramp do it.
- Loss-of-comms behavior. When the HMI connection drops, the PLC tag retains its last value. The drive continues at the last commanded speed. Add a watchdog that zeros the AO if the HMI connection state is not refreshed within a defined time, especially for safety-rated applications.
- Use the engineering unit, not the raw count, in the operator screen. Operators should never see "27648"; they should see "50.0 Hz." Bind the HMI I/O Field to a Real tag, not a Word/Int tag, in any production release.
Do I really need the PLC to do the scaling, or can I just write 0–27648 directly from the HMI to %QW96?
Yes, you can. Point the HMI I/O Field's process tag at %QW96, set the format to a five-digit integer, and the HMI writes the raw value directly. It works for a class project or a single-channel bench test, but it forces the operator to think in raw counts (27648 = 50 Hz), which is not acceptable for a production HMI. Use NORM_X and SCALE_X on the PLC side for any operator-facing screen.
What is the difference between NORM_X and the legacy NORM instruction?
Both convert a value to a normalized 0.0–1.0 real. NORM_X (TIA Portal V13+) accepts a typed input value, min, and max as separate IN parameters and is intended to be used in series with SCALE_X for the inverse operation. The legacy NORM and SCALE instructions (STEP 7 Classic / early TIA) take different parameter sets but produce equivalent results. Use NORM_X + SCALE_X in any new TIA Portal V16+ project.
Why does my motor run at half the commanded speed?
Three typical causes: (1) the drive's analog input is set to 0–5 V mode but the PLC is outputting 0–10 V; (2) the drive's reference-scaling parameter is set to a maximum of 5 V (e.g., P0757 on SINAMICS V20 is set to 5.0 instead of 10.0); (3) the SCALE_X block has a wrong maximum input value. Measure the AO terminal voltage with a multimeter, then read the drive's scaling parameters, to isolate the cause.
Can the HMI write a value above 27648 to the analog output?
Yes, the HMI will write whatever value the operator types if the I/O Field limits are not set. The S7-1200 AO will saturate at the configured type's maximum (10.0 V or 20.0 mA) and the over-range diagnostic is set in the channel status. Always set the HMI I/O Field's upper limit to 27648 (raw) or to the maximum engineering value (e.g., 50.0 Hz) to prevent the over-range band from being written accidentally.
Do I need an analog-input card too, or can I drive the VFD directly from the PLC's analog output?
You do not need an analog input on the PLC for the speed-reference path. The PLC is the source of the speed reference; it writes the AO directly and the VFD receives it. An analog input is only needed if you are reading a feedback signal back into the PLC (e.g., a load-cell, a flowmeter, or a tachogenerator). For a class project, a CPU 1214C with a single SB 1232 output is sufficient.