Resolving S7-1200 CTRL_PWM No Output on SB1222 Signal Board
When a CTRL_PWM instruction in OB1 reports ENABLE = TRUE and BUSY=TRUE, but the configured SB 1222 output (Q4.0, Q4.1, Q4.2, or Q4.3) shows a flat 0 V or 24 V level on a scope, the most common root cause is a stale TIA Portal project where the program blocks have been downloaded to the CPU but the device configuration (the section that maps the four pulse generators to physical SB 1222 outputs and sets the PWM frequency / duty cycle) has not been re-transferred. This article documents the root cause, the CTRL_PWM instruction behavior, the exact download sequence that fixes the problem, and the verification checks that confirm a switching waveform is being generated on the SB 1222 outputs.
1. Problem Summary
Symptom: A CTRL_PWM block instance is called in OB1 with ENABLE = TRUE. In online monitoring, the block reads BUSY = TRUE and STATUS = W#16#7000 or W#16#0000, indicating that the instruction is processing cleanly. The expected square-wave signal is absent at the SB 1222 terminals. A handheld scope, logic analyzer, or even the LED of a 24 V indicator wired to the output confirms that the output is statically low (or high) and never toggles.
Environment: SIMATIC S7-1200 CPUs (1211C, 1212C, 1214C, 1215C, 1217C) with a SB 1222 signal board installed in the right-hand signal-board slot. TIA Portal V14 SP1 or newer (V15, V15.1, V16, V17, V18, V19, V20). Firmware of the CPU is 4.x or higher. The user has enabled the pulse generators for the SB in the device configuration and wired CTRL_PWM to the HW_ID of the chosen channel.
Recovery: The project compiles cleanly and downloads without diagnostics. Re-stopping and re-starting the CPU does not change the behavior. Online → Diagnostics shows the SB 1222 as configured but no PWM activity. The block re-enters BUSY=TRUE the moment OB1 cycles, so the CPU is reading and writing the block correctly — it is the missing hardware download that prevents the pulse generator from being armed.
2. Affected Hardware and Firmware
The following Siemens part numbers are commonly seen in this failure mode. Always cross-check with the current catalog or with the SIMATIC S7-1200 system manual before specifying a part.
| Module | Article number | Role in this fault |
|---|---|---|
| CPU 1212C DC/DC/DC | 6ES7212-1AE40-0XB0 | Host; supplies pulse-generator channels |
| CPU 1214C DC/DC/DC | 6ES7214-1AG40-0XB0 | Host; up to four PWM channels routable to SB |
| CPU 1215C DC/DC/DC | 6ES7215-1AG40-0XB0 | Host; up to four PWM channels routable to SB |
| SB 1222 DO 4×24 V DC / 0.5 A | 6ES7222-1AD30-0XB0 | Carries Q4.0–Q4.3 as PWM outputs |
| SB 1222 DO 4×5 V DC / 0.1 A | 6ES7222-1BH30-0XB0 | 5 V variant; same PWM channel mapping |
| SB 1223 DO 2×24 V / DI 2×24 V | 6ES7223-0BD30-0XB0 | Not the failed device in this report — but shares slot address space |
Firmware prerequisites: PWM on SB 1222 outputs is supported on CPU firmware V4.0 and higher. If the CPU is at V3.x, TIA Portal will refuse to expose the pulse-generator tab in the device configuration, and the symptom of "CTRL_PWM busy, no output" can be triggered for a completely different reason: the generator was never assigned in the first place because the firmware predates the feature. Upgrade to V4.2 (or current) and re-load.
3. Root Cause: Why Program Block Downloads Are Not Enough
TIA Portal separates the project into two related but independently compiled artifacts:
- Program blocks — the OB, FB, FC, DB, and system blocks that execute at runtime. These are stored in the CPU's load memory and work memory.
- Hardware configuration (System Data) — the device tree, slot assignment, module parameters, and the pulse-generator descriptors that tell the CPU which output is PWM1, which is PWM2, the switching frequency, the initial duty cycle, and the HW_ID that user code will reference. This is stored as "System Data" in the CPU's load memory and is mapped into the I/O area at startup.
When you click Download to device on the project tree with the "Blocks" node selected, TIA Portal only writes program blocks. The pulse-generator descriptors remain as they were on the previous download. If the project previously had no pulse generator on the SB 1222, and you have since opened Device configuration → SB 1222 → Properties → Pulse generators and enabled PWM1–PWM4, the project file is updated but the CPU still believes the SB 1222 is a plain digital-output board. The CTRL_PWM block, in turn, addresses a HW_ID that the CPU does not recognize as a pulse generator — the call returns with BUSY=TRUE and a benign-looking STATUS, but the silicon never toggles.
The fix is to perform a hardware-configuration download. The simplest user action is to right-click the PLC device node (typically PLC_1) in the project tree and choose Download to device → Hardware configuration. TIA Portal will then write the system data, restart the I/O if required, and the pulse generators become armed.
Decision Flow
4. CTRL_PWM Instruction Technical Reference
The CTRL_PWM instruction is the standard software interface for the S7-1200 pulse generators. It is located in the TIA Portal instruction tree under Extended Instructions → Pulse → CTRL_PWM. According to the SIMATIC WinCC / S7-1200 manual collection and the TIA Portal online help for CTRL_PWM, the instruction provides a fixed-cycle-time output with a variable duty cycle. Once enabled, the PWM runs continuously at the configured frequency until ENABLE is set to FALSE or the CPU enters STOP.
| Parameter | Direction | Data type | Description |
|---|---|---|---|
PWM |
Input | HW_IO / HW_ID (WORD) | Hardware identifier of the pulse generator. Resolved via the device configuration → System constants. |
ENABLE |
Input | BOOL | TRUE starts the generator; FALSE stops it. Edge-triggered internally. |
BUSY |
Output | BOOL | TRUE while the instruction is being processed. |
STATUS |
Output | WORD | Error / event code. W#16#0000 = no error. |
The frequency and the initial duty cycle are not parameters of the CTRL_PWM block — they are configured statically in the device configuration under the pulse generator's properties (cycle time in microseconds, or frequency in Hz; pulse width as a percentage or in time units). The block is purely a runtime enable/disable. This is the source of much confusion: a user expects to change frequency from user code, but the runtime API is limited to start/stop unless a higher-level function block (or a project-specific wrapper) is added.
Minimal LAD Example
The following ladder snippet is the canonical pattern. One CTRL_PWM instance per physical output. The hardware identifier of the SB 1222 pulse generator is dragged from System constants → Pulse generators directly into the PWM input box:
Network 1: PWM1 on Q4.0 (SB 1222 channel 0)
+---[ I_PWM_Start ]---[ CTRL_PWM ]---( )---+
| PWM := "PWM1" |
| ENABLE := TRUE |
| BUSY => "PWM1_Busy" |
| STATUS => "PWM1_Status" |
+------------------------------------------+
Minimal SCL Example
// OB1 - cyclic
IF "i_Start_PWM1" THEN
"PWM1_DB"(PWM := "PWM1", // HW_ID of SB1222 channel 0
ENABLE := TRUE,
BUSY => "PWM1_Busy",
STATUS => "PWM1_Status");
END_IF;
5. Pulse Generator Configuration on SB 1222
The SB 1222 exposes four digital outputs at process-image addresses Q4.0 through Q4.3 (with the SB installed in the right-hand signal-board slot and a CPU 1214C as the host). Each of these outputs can be routed to a pulse generator using the device configuration:
- In the project tree, expand PLC_1 → Device configuration.
- Click the SB 1222 module in the device view. The slot is the small letter to the right of the CPU in the rack diagram.
- Open Properties → Pulse generators (PTO/PWM) in the inspector window.
- Check Enable for PWM1, PWM2, PWM3, and/or PWM4, depending on how many channels are needed.
- For each enabled channel, set the Output field to the desired Q4.x bit.
- Set the Cycle time (or the equivalent frequency) and the Initial pulse width (initial duty cycle).
- Compile the project. TIA Portal exposes the HW_IDs of the four pulse generators under PLC_1 → System constants → Pulse generators. These are the tags to wire to the PWM input of CTRL_PWM.
Frequency and Duty Cycle Range
For an SB 1222 driven by an S7-1200 CPU of firmware V4.x, the supported PWM range is approximately 1 Hz to 200 kHz with a duty cycle resolution of 0.1 % (1 part in 1000). The exact upper limit depends on the CPU variant and on the load connected to the SB 1222 output — confirm the limit in the data sheet of the specific SB 1222 article number before driving a high-frequency load. The duty cycle can be set to 0 % (output held low) or 100 % (output held high) in the static configuration; the dynamic range supported by CTRL_PWM at runtime is the same window.
6. Step-by-Step Resolution Procedure
Apply the following procedure after a CTRL_PWM block has been configured but no switching is observed on the SB 1222 outputs. Each step is independently verifiable.
- Confirm SB 1222 article number and slot. Verify in the device configuration that the SB 1222 is in the right-hand signal-board slot and that the article number matches what is physically clipped to the CPU. A mismatched SB in the project is a common silent fault.
- Confirm pulse generators are enabled. In Device configuration → SB 1222 → Properties → Pulse generators, ensure that PWM1, PWM2, PWM3, and/or PWM4 are checked, that each one is routed to a Q4.x output, and that the cycle time and initial pulse width are non-zero.
- Compile the project. Use Project → Compile → All (or right-click PLC_1 → Compile). TIA Portal must report a clean compile — warnings about pulse generators typically indicate a misconfiguration.
- Go online to the CPU. From the menu bar, Online → Go online. Confirm the SB 1222 is detected by the CPU and that the order number matches.
- Download the hardware configuration. Right-click the PLC_1 node in the project tree. Choose Download to device → Hardware configuration. If prompted, select the network interface and confirm the overwrite. TIA Portal will write the system data, may briefly stop the I/O, and re-arm the pulse generators.
- Download the program blocks. After the hardware download completes, right-click PLC_1 → Program blocks and choose Download to device → Software (all blocks). This brings the CTRL_PWM instance DBs into the CPU.
- Start or restart the CPU. If the CPU is in STOP, switch to RUN. The CTRL_PWM block will start toggling the SB 1222 outputs within one OB1 cycle.
- Monitor the block online. In OB1, watch the BUSY and STATUS outputs. STATUS should read W#16#0000 or transiently W#16#7001 / W#16#7002 during the first call, then settle to W#16#0000.
- Probe the output. Place a scope on Q4.0 (or whichever channel is enabled). A clean rectangular waveform at the configured frequency, with the configured duty cycle, should be visible.
7. Verification Procedure
After the download, the following checks confirm that the SB 1222 is now producing the expected PWM signal.
| Check | Method | Expected result |
|---|---|---|
| SB 1222 recognized | Online → Diagnostics → Device information | Order number matches the article number; status OK; no diagnostic interrupts pending. |
| Hardware config loaded | Online → Compare offline/online on PLC_1 | Offline and online configurations match; the pulse-generator tab shows the enabled channels. |
| CTRL_PWM block state | OB1 online monitor | BUSY = TRUE; STATUS = W#16#0000 (or transient W#16#7001 / W#16#7002 on the first cycle). |
| Output toggling | Handheld scope on Q4.0 to Q4.3 | Rectangular waveform at the configured frequency, duty cycle matching the device configuration. |
| LED on SB 1222 | Visual inspection | Status LEDs blink at the configured rate (visible at low frequencies; indistinguishable at high frequencies). |
| Load response | Connect the intended load (valve, LED strip, opto input, etc.) | Load behaves as expected (e.g., proportional valve moves to a stable position; LED dims according to duty cycle). |
| CPU diagnostics buffer | Online → Diagnostics → Diagnostics buffer | No new entries after the download. Pre-existing entries related to the previous (stale) configuration can be cleared. |
8. STATUS Word Error Code Reference
The STATUS output of CTRL_PWM reports hexadecimal codes. The most common ones encountered during commissioning are listed below. The values are sourced from the SIMATIC S7-1200 system manual and the TIA Portal online help for CTRL_PWM; always consult the current manual for the exact list applicable to your firmware version.
| STATUS (hex) | Meaning | Typical corrective action |
|---|---|---|
| W#16#0000 | No error; PWM running or stopped cleanly. | None required. |
| W#16#7000 | No job being processed (ENABLE = FALSE). | Expected when the start input is FALSE. |
| W#16#7001 | First execution of the job after ENABLE rising edge. | Informational; transient. |
| W#16#7002 | Consecutive execution; PWM running. | Informational. |
| W#16#80A1 | HW_ID of the pulse generator invalid or unknown to the CPU. | Re-check System constants; confirm that the device configuration was downloaded. |
| W#16#80B0 | Pulse generator not enabled in hardware configuration. | Open Device configuration → SB 1222 → Pulse generators, check the corresponding channel, and re-download the hardware configuration. |
| W#16#80B1 | Configured frequency is out of the supported range. | Adjust the cycle time / frequency in the pulse-generator properties. |
| W#16#80B2 | Configured duty cycle is out of the supported range. | Adjust the initial pulse width in the pulse-generator properties. |
| W#16#80B3 | Pulse generator already in use by another resource. | Confirm that no other block, motion task, or PTO function is driving the same channel. |
9. Common Pitfalls and Edge Cases
- Wiring assumption. A scope trace on Q4.0 of the SB 1222 must be taken with the probe ground clip on a known 0 V reference. Floating grounds create the illusion of a stuck output even when the silicon is switching correctly. Confirm ground reference before changing the program.
- Wrong HW_ID wired to CTRL_PWM. TIA Portal will happily accept a HW_ID from a different module, and the block will run without a hard error. Cross-check the HW_ID in System constants against the pulse generator you actually enabled in the SB 1222 properties.
- Output already in use by a motion axis. The S7-1200 motion control library will claim pulse generators for its axis objects. If a TO (technology object) for PTO or positioning is configured on the same channel, the CTRL_PWM block returns W#16#80B3. Either drop the axis or pick a different SB 1222 output.
- Process image update. PWM outputs are written to the SB 1222 hardware by the I/O update, not by the user program. There is no need (and no benefit) to set Q4.0 from ladder logic while the pulse generator is active; the CPU ignores user writes to that bit.
- CPU in STOP. The pulse generator stops immediately when the CPU goes to STOP. If the program appears to have stopped working after a power cycle, confirm the CPU is actually in RUN, not in startup with a forced STOP.
- Online edits that did not propagate. Editing the pulse-generator properties in the device configuration and pressing Ctrl+S does not re-download the system data. The user must explicitly right-click PLC_1 and choose Download to device → Hardware configuration. This is the single most common reason for the symptom described in this article.
- Firmware mismatch. If the CPU firmware is upgraded but the project is not recompiled against the new firmware, the HW_IDs may shift or be invalidated. After any firmware change, perform a full compile and a full hardware-configuration download.
- Simulator vs. real CPU. CTRL_PWM can be exercised in PLCSIM, but the SB 1222 pulse generators are not actually exercised on a real load in the simulator. Confirm behavior on the real hardware before declaring a fix.
10. Frequently Asked Questions
Why does CTRL_PWM report BUSY = TRUE and STATUS = 0 but the SB 1222 output is still flat?
STATUS = W#16#0000 indicates that the instruction is being processed without error, but it does not prove that the pulse generator is armed. The pulse generator is armed by the device configuration, not by the program block. If the device configuration was not downloaded after the pulse generator was enabled, the CPU has no record of the channel and produces no switching output. Right-click PLC_1, choose Download to device → Hardware configuration, and verify on the scope.
How many pulse generators can I route through a single SB 1222?
Up to four — one per SB 1222 output. Use PWM1 for Q4.0, PWM2 for Q4.1, PWM3 for Q4.2, and PWM4 for Q4.3. Each generator must be enabled in the device configuration and addressed by its own HW_ID. Each generator needs its own CTRL_PWM instance and instance DB.
Do I have to download the hardware configuration every time I change the PWM frequency?
Yes. Frequency and initial duty cycle are static properties of the pulse generator and are stored in the system data. Any change in the Device configuration → Pulse generators tab must be written back to the CPU with a hardware-configuration download. Program-block-only downloads will leave the new frequency in the project but not in the running CPU.
Can I change the duty cycle at runtime from user code?
The stock CTRL_PWM instruction only enables and disables the pulse generator. The frequency and duty cycle are set in the device configuration. To change the duty cycle at runtime, use a motion-control technology object (TO_PWM) on a supported firmware, or build a wrapper FB around CTRL_PWM plus a system function that writes to the pulse generator's pulse-width tag. Consult the SIMATIC S7-1200 motion control manual for the firmware-specific options.
What STATUS code confirms that a hardware-configuration download is required?
W#16#80B0 indicates that the pulse generator is not enabled in the hardware configuration. After a clean program download, W#16#80B0 is the canonical signature of a missing hardware-configuration download. W#16#80A1 (invalid HW_ID) and W#16#80B3 (generator already in use) are close cousins and point at related configuration mismatches.