1. Overview: Alarm_S in TIA Portal
The Alarm_S family of instructions is the legacy mechanism for generating PLC-driven alarms that are routed to a WinCC Comfort, Advanced, or Professional HMI. In the S7-300/400 generation these instructions were System Function Blocks (SFB35/36/37/38). In TIA Portal they appear in the project tree under Program blocks > System blocks > Alarm and behave conceptually identical to their STEP 7 V5.x / V11 predecessors. They are the correct tool when:
- An alarm must be generated and routed to the HMI based on a discrete PLC condition (bit) or based on the existence of data records in an associated DB.
- You need an explicit acknowledgment bit (acknowledgment model "with acknowledgement").
- You want the alarm to be raised from the CPU firmware path, ensuring the message is delivered even if the cyclic HMI connection is momentarily disturbed.
- You want to display associated values (process values embedded in the alarm text) for diagnostics.
The Comfort/Advanced HMI receives these alarms over the standard S7 HMI connection (TCP/IP or PROFIBUS) and renders them in the Alarm view, Alarm window, or Alarm log controls. The configuration flow is therefore split between two editors:
- STEP 7 (PLC) editor – declares the alarm source (FB/instance-DB), the trigger condition, message text, and the alarm class (acknowledgment model).
- WinCC (HMI) editor – adds an Alarm view/window control, configures the alarm classes, filters, sorting, and the log archive behavior.
2. Prerequisites
- Engineering: TIA Portal STEP 7 Professional + WinCC Comfort/Advanced (or a combined TIA Portal package such as V16/V17/V18/V19/V20).
- PLC firmware: S7-300/S7-400 firmware that includes the SFBs 35-38 (Alarm_S family) – all standard CPU firmware from V3.x onwards; S7-1200/1500 do not use these legacy SFBs.
- HMI runtime: WinCC Comfort/Advanced Runtime (panel-side) supporting the alarm class configuration described in chapter "Working with alarms" of the WinCC Comfort/Advanced manual.
- HMI connection: An S7 HMI connection between the PLC and the HMI panel, configured in Devices & Networks. Routing and access to the CPU protection list must allow GET/PUT for the alarm subscription.
- Project-level knowledge of the alarm class taxonomy used on the plant (e.g. Errors, Warnings, Information) and the acknowledgment policy for each.
3. The Alarm_S Instruction Family
The four SFBs differ in two dimensions: trigger type (bit vs. data record) and acknowledgment (yes/no). Choose the SFB that matches the event semantics on the shop floor.
| SFB | Symbolic name | Trigger | Acknowledgment | Typical use case | Associated values |
|---|---|---|---|---|---|
| SFB35 | ALARM_S | Single bit, edge | No | Status notification (e.g. "Valve V101 open") | No |
| SFB36 | ALARM_SQ | Single bit, edge | Yes – must be acknowledged by HMI/operator | Fault that requires operator intervention (e.g. "Motor overload") | No |
| SFB37 | ALARM_D | Data record sent to the assigned partner | No | Status change involving several process values (e.g. recipe step change) | Up to 10 associated values from DB |
| SFB38 | ALARM_DQ | Data record sent to the assigned partner | Yes | Critical event with context (e.g. "Drive fault with motor amps and speed") | Up to 10 associated values from DB |
The instruction call interface in TIA Portal is identical for the four blocks. After you drop ALARM_SQ into a code block, the F1 help of TIA Portal provides the input/output parameter list.
3.1 Input/output interface (ALARM_SQ reference)
| Parameter | Direction | Data type | Meaning |
|---|---|---|---|
| EN | Input | BOOL | Enable the call |
| SIG | Input | BOOL | Trigger signal. Edge 0→1 raises the alarm; 1→0 clears it |
| ID | Input | WORD | Channel ID (W#16#EEEE default = always assign) |
| EV_ID | Input | DWORD | Message number (must be unique inside the CPU; editor assigns automatically) |
| SEVERITY | Input | WORD | Alarm class (0..127). Maps to a WinCC alarm class |
| STATE | InOut | WORD | ACK state passed between CPU and HMI |
| ACK_STATE | Output | WORD | Returns 1 when the HMI has acknowledged the alarm |
| ENO | Output | BOOL | Enable out |
4. PLC-Side Configuration
Configuration of an alarm source in TIA Portal comprises four steps: create a Function Block (or use OB1), declare an Instance-DB, call the Alarm_S instruction, then edit the message properties of the instance-DB. The HMI connection is wired in Devices & Networks; the alarm text lives on the PLC side and is pushed to the HMI at compile/download.
4.1 Create the Function Block
- In the project tree, right-click Program blocks > Add new > Function block.
- Name the FB descriptively (e.g.
FB_Alarms_Motor). The FB will hold the alarm logic and become the owner of the message definition. - Open the FB editor and add the required interface variables (see example in §6).
4.2 Add the Alarm_S call
- From the right-hand Instructions task card, expand Communication > S7 Communication / Alarm and drag the appropriate block (
ALARM_S,ALARM_SQ,ALARM_D,ALARM_DQ) into a network of the FB. - Wire
SIGto a boolean tag or to the output of your trigger logic (e.g."MotorFault"). - Leave
IDasW#16#EEEE(assign to all configured partners – the standard HMI setup). - For
EV_ID, let the editor auto-assign. Manually enter a value only if you need to keep the message number stable across project versions. - For
SEVERITY, enter a class value that matches the alarm class mapping on the HMI (e.g.16#0001for "Errors – with acknowledgement").
4.3 Generate the instance DB and edit the message
- Drag the FB into
OB1(or a cyclic interrupt OB). TIA Portal auto-generates the instance DB (e.g.DB_Alarms_Motor). - Right-click the instance-DB > Properties > Message. The Message editor opens. Each invocation of an Alarm_S block creates a row where you can fill in Message text, Info text, Alarm class, and Acknowledgment.
- Use placeholders for associated values when invoking ALARM_D/ALARM_DQ, e.g.
@1%d@,@2%f@– the values are passed via theSD_1..SD_10inputs of the D variants.
4.4 Compile, download, and verify the alarm subscription
- Compile the S7 program (right-click CPU > Compile > Software (rebuild all)).
- Download the program to the CPU. The CPU's Online & diagnostics > Alarms view now shows the registered alarm source(s).
- Trigger the alarm by setting
SIG = 1in the variable table. The CPU should report a pending alarm in the diagnostics buffer.
5. HMI-Side Configuration (WinCC Comfort / Advanced)
The HMI is purely a subscriber for PLC alarms defined via Alarm_S. After the HMI is connected to the PLC and the program is compiled, the alarm rows appear in the HMI project under HMI alarms > PLC alarms. You then decide how to display them.
5.1 Connect the HMI to the PLC
- In Devices & Networks, create an S7 connection between the HMI and the PLC.
- Set the HMI as the partner at the appropriate interface slot (Ethernet or PROFIBUS). The connection wizard will populate the IP / PROFIBUS addresses.
- Compile both stations; in the Connection view the connection status must show "Established" on the HMI runtime start.
5.2 Verify the PLC alarm is visible to the HMI
- Open the HMI device configuration.
- Select HMI alarms > PLC alarms. The alarms defined on the PLC side via the Alarm_S SFBs should be listed automatically (TIA Portal populates them on compile).
- If the list is empty, check the connection direction (HMI must be a partner of the alarm source) and that the instance-DB message is enabled.
5.3 Add the Alarm view / Alarm window control
- Open the desired HMI screen.
- From the Toolbox > Controls palette, drag the Alarm view, Alarm window, or Alarm log control onto the screen.
- Configure the control:
- Source: PLC alarms (or All alarms if you mix HMI-tag and PLC alarms).
- Filter: by alarm class, by area, or by priority.
- Columns: Number, Time, State, Text, Acknowledgment.
- Sort: newest first or by priority.
- Wire the Acknowledge button on the toolbar to a script or leave it on default (the HMI sends the acknowledgment back to the CPU and clears
ACK_STATE).
5.4 Alarm class mapping (PLC severity → HMI class)
| CPU severity (SEVERITY) | Default WinCC class | Background color | Requires acknowledgement? |
|---|---|---|---|
| 16#0001 | Errors | Red | Yes (if ALARM_SQ/DQ used) |
| 16#0002 | Warnings | Yellow | Optional |
| 16#0003 | Information | Gray | No |
| 16#0004..16#007F | User-defined | Configurable | Configurable |
5.5 Status of the alarms
The status of an alarm – and the information displayed in the Alarm view – depends on the view context. The current Siemens TIA Portal V20 documentation on "Status of the alarms" distinguishes the two contexts:
- Current alarms view – shows alarms that are active (trigger condition is still TRUE on the PLC). Acknowledged alarms remain visible until the trigger condition goes FALSE.
- Alarm archive (log) – shows the historical record of alarms with their full life cycle: came in, went out, acknowledged, locked / unlocked. Use this view for post-event diagnostics and operator logbook review.
For each alarm row the following states can appear in the status column:
| Status icon | State | Meaning |
|---|---|---|
| ↑ | Came in (active) | Trigger is TRUE, alarm has not been acknowledged |
| ↑ + ✓ | Came in, acknowledged | Trigger TRUE, but operator has acknowledged |
| ↓ | Went out | Trigger went FALSE; alarm cleared |
| 🔒 | Locked | Alarm disabled by configuration; will not be raised |
| ⚙ | Enable state | Alarm source has the enable bit OFF |
6. Practical Code Example (ALARM_SQ)
The following FBD snippet shows a typical motor-folder alarm using ALARM_SQ in a Function Block.
FUNCTION_BLOCK FB_Alarms_Motor
VAR
bMotorFault : BOOL; // input: TRUE on overload
bAckReceived : BOOL; // output: TRUE when HMI acks
wAlarmState : WORD; // in/out: state with HMI
END_VAR
BEGIN
NETWORK 1
// Edge-triggered alarm call - SFB36 / ALARM_SQ
// SIG bMotorFault
// ID W#16#EEEE (assign to all HMI partners)
// EV_ID DW#16#00010001 (auto-assigned is also OK)
// SEVERITY W#16#0001 (Errors - with acknowledgement)
// STATE wAlarmState (INOUT)
// ACK_STATE bAckReceived (OUTPUT, used in logic below)
ALARM_SQ(
SIG := bMotorFault,
ID := W#16#EEEE,
EV_ID := DW#16#00010001,
SEVERITY := W#16#0001,
STATE := wAlarmState,
ACK_STATE => bAckReceived );
NETWORK 2
// Optional: use the acknowledgment in your safety logic
// IF bAckReceived THEN
// // operator has seen the fault; do not auto-reset
// END_IF;
END_FUNCTION_BLOCK
Compile the FB and the instance-DB. Open the instance-DB's Properties > Message tab and enter the alarm text, e.g.:
- EN:
Motor %<tagname1>% overload detected – setpoint %<tagname2>% A - DE:
Motor %<tagname1>% Überlast erkannt – Sollwert %<tagname2>% A
7. Diagnostics Controls on Comfort Panels
Comfort and Advanced panels ship with a special set of diagnostics controls that go beyond the standard Alarm view and are valuable for troubleshooting Alarm_S problems:
| Control | Purpose | Use it for |
|---|---|---|
| Alarm view | Lists active and acknowledged alarms | Operator HMI screens |
| Alarm window | Pop-up summary of pending alarms | Global visibility, even from non-alarm screens |
| Alarm log / Archive | Persisted historical record (SQL or CSV) | Shift logs, post-event analysis |
| System diagnostics view | Shows PLC + PROFINET diagnostics | Troubleshooting lost connections, module faults |
| PLC diagnostics view | Detailed diagnostic buffer of the CPU | Root-cause analysis of why an alarm was raised |
| Network diagnostics view | PROFINET topology + port status | Verifying the HMI–PLC connection |
Insert these from Toolbox > Controls > Diagnostics. They do not need any extra configuration; they query the HMI connection at runtime.
8. Common Errors and Troubleshooting
| Symptom | Likely cause | Verification | Fix |
|---|---|---|---|
| Alarm does not appear on the HMI | No S7 connection; EV_ID not registered | Online > HMI > Connections: status "Established" | Re-create the connection; check the routing table |
| Alarm appears but cannot be acknowledged | Wrong SFB used (ALARM_S instead of ALARM_SQ) | Check FB call | Replace with ALARM_SQ or ALARM_DQ |
| Alarm text shows raw placeholder tags | Associated values not declared | Inspect the SD_1..SD_10 inputs |
Wire all referenced values to the block's SD inputs |
| Alarm appears on PC but not on panel | Panel runtime project not re-compiled | Panel HMI alarms list vs. PC list | Recompile the HMI project and transfer |
| Alarm duplicates | FB called in multiple OBs (OB1 + OB35) with same instance-DB | Cross-reference the call | Call only once per cycle or use separate instance-DBs with distinct EV_IDs |
| "Message disabled" in alarm view | Alarm locked or enable bit is FALSE | Right-click alarm row > Status | Remove the lock in the alarm editor or set the enable bit |
| Wrong language on the HMI | Language not defined on PLC | Open the PLC message text editor > language list | Add the language and enter the translated text |
9. Step-by-Step Recap
- Create the HMI in the project (Comfort/Advanced), add an S7 connection to the PLC.
- On the PLC, create an FB. Add the Alarm_S SFB call inside the FB. Wire the trigger and
ID/EV_ID/SEVERITY. - Generate the instance-DB by calling the FB from OB1.
- Open the instance-DB > Properties > Message and enter the text, info text, and class.
- Compile the S7 program, then the HMI program. The alarm appears under HMI alarms > PLC alarms.
- Add an Alarm view or Alarm window control to the HMI screen. Configure the filter and columns.
- Download both stations. Set
SIG = 1from the watch table to trigger the alarm; verify the row appears on the HMI with the correct status, then acknowledge it.
10. Verification Checklist
- [ ] The PLC diagnostics buffer records the message number on
SIGedge 0→1. - [ ] The Alarm view on the HMI shows the new row within one update cycle (~1 s typical).
- [ ] The state column changes from Came in to Came in, acknowledged after pressing the Acknowledge button.
- [ ] When
SIGreturns to 0, the state changes to Went out. - [ ] If using the alarm log, the entry is persisted in the configured storage (SD card / USB / network share).
FAQ
Where do I find the Alarm_S instructions in TIA Portal?
Open the PLC's Program blocks, then in the Instructions task card expand Communication > Alarm. You will find ALARM_S, ALARM_SQ, ALARM_D and ALARM_DQ. Drag the one you need into a Function Block and wire its inputs. The original STEP 7 V11.0 SP2 manual covers the same configuration in chapter 9.5.
What is the difference between ALARM_S and ALARM_SQ?
ALARM_S (SFB35) raises a status notification that the operator does not have to acknowledge. ALARM_SQ (SFB36) raises a notification that requires explicit acknowledgment by the HMI – the operator must press the Acknowledge button before the alarm leaves the "active, not acknowledged" state.
Can I use Alarm_S with an S7-1200 or S7-1500 CPU?
No. The Alarm_S SFBs (SFB35-38) are legacy S7-300/400 blocks. For S7-1200/1500 you use the Program_Alarm instruction and the message editor on the FB itself, with WinCC Comfort/Advanced subscribing to those alarms over the standard S7 connection.
How do I pass process values to the HMI as part of the alarm text?
Use ALARM_D or ALARM_DQ and wire your process values to the SD_1..SD_10 inputs. In the message text on the instance-DB, reference them with placeholders @1%d@, @2%f@, etc. At runtime the HMI substitutes the live value into the displayed text.
Why is the alarm visible on the PC runtime but not on the Comfort panel?
The Comfort panel project has not been recompiled and retransferred after the alarm was added on the PLC side. Recompile the HMI station (right-click the HMI > Compile) and transfer the resulting .tia runtime file to the panel, then restart the panel runtime.
How do I distinguish "current alarms" from historical entries in the Alarm view?
Per the official TIA V20 documentation on the status of the alarms, the current alarm view shows the active state of alarms whose trigger is still TRUE on the PLC, while the alarm archive shows the full life cycle (came in, went out, acknowledged, locked). Use the Alarm log control on the panel to display the archive.