PCS 7 V7.1 OpenGroupDisplay Triggered from CFC: C Reference

David Krause18 min read
HMI / SCADASiemensTechnical Reference
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

Opening PCS 7 V7.1 Faceplates from CFC/SFC Logic: A C-Action Implementation Guide

Siemens SIMATIC PCS 7 V7.1 supports automatic faceplate invocation not only from a mouse click on the block icon, but also from automatic control flow such as SFC steps and CFC chart logic. The wiring depends on three layers: a WinCC tag that carries the trigger pulse, a custom property on the block icon that propagates the value through a Dynamic Dialog, and a C-action in the WinCC Graphics Designer that calls PCS7_OpenGroupDisplay_V6(). This reference consolidates the working pattern, fixes the most common syntax error (C compiler error 0040: "')' expected"), implements single-shot opening with rising-edge detection, and provides a robust Picture Window fallback that does not require any C runtime code at all.

1. Overview

The original use case is straightforward: an SFC plan must, on entering a specific step, automatically open a custom faceplate for operator setpoint entry; after the operator closes the faceplate, the SFC continues with its sequencer. The standard PCS 7 interaction model assumes the operator clicks a block icon, which fires the block icon's "Mouse Click" event and ultimately calls the same PCS7_OpenGroupDisplay_V6() function. To trigger the same code path automatically, the engineer must replace the click with a tag-driven Change event on a custom property of the block icon, and that property must be pulsed from the SFC in a way that only fires once per request.

This article covers three solutions in increasing order of robustness:

  1. C-action on a custom property's Change event with a guarded PCS7_OpenGroupDisplay_V6() call.
  2. C-action with rising-edge detection via the Q_TRIG CFC block or the C-action's value argument.
  3. Picture Window whose picture name and visibility are bound to SFC-controlled WinCC tags, completely avoiding the C runtime.

The third method is the recommended production approach because it does not require the WinCC C compiler, regenerates cleanly across OS downloads, and is fully debuggable in the standard WinCC tag diagnostics. The first two are documented because they are sometimes unavoidable when the faceplate must appear at a specific screen coordinate that already hosts a block icon.

2. Architecture: Faceplate, Block Icon, and Group Display

A PCS 7 faceplate is a WinCC picture (PDL file) that visualises the parameters, messages, and trends of a single AS block instance. A block icon is a smaller, screen-level graphic that represents the same block instance on an overview or unit picture and is connected to the faceplate through the "Group Display" mechanism. When the operator clicks a block icon, WinCC evaluates the block icon's configured "Group Display" property, which encodes the picture name and object name of the faceplate, and then calls the OpenGroupDisplay C function to bring up the faceplate on top of the current picture.

The same call can be triggered programmatically. The relevant WinCC C API is the family of PCS7_OpenGroupDisplay_Vx functions, one per major PCS 7 release. The V6 variant used in PCS 7 V7.1 has the signature:

void PCS7_OpenGroupDisplay_V6(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);

The two arguments identify the picture that contains the block icon and the block icon object within that picture. The function reads the "Group Display" property of the block icon, locates the matching faceplate PDL, and opens it in the standard view. The function is documented in the WinCC V7.0 / PCS 7 V7.1 C-API reference and on the Siemens Industry Online Support portal under the "WinCC / PCS 7 C-API for faceplate opening" application example.

For the call to work, the block icon must already exist on the source picture and must have a valid Group Display property configured. If you are authoring a new custom block, complete the block icon first via the Faceplate Designer before wiring the auto-open logic.

PCS 7 V7.1 faceplate invocation layers
Layer Component Responsibility
AS CFC chart / SFC plan Generates the trigger pulse from operator command or sequencer step
OS tags WinCC binary tag (e.g. SFC_OpenFaceplate_TRIG) Carries the trigger pulse from AS to OS
Block icon Custom property (e.g. Display1) Propagates the trigger value via Dynamic Dialog
WinCC runtime C-action on Change event Calls PCS7_OpenGroupDisplay_V6 to open the faceplate
PDL Faceplate PDL (standard view, message view, trend view) Receives focus and processes operator input

3. Prerequisites

Before implementing automatic faceplate opening in PCS 7 V7.1, confirm the following:

  • The PCS 7 ES (Engineering Station) is at V7.1 with SPx updates applied; the WinCC component is at V7.0 or V7.0 + SPx.
  • The custom CFC block type has a complete Faceplate Designer artefact, including a standard view PDL and a configured Group Display property.
  • The block icon is placed on the target overview or unit picture and the standard click-to-open behaviour is verified manually before the auto-open logic is added.
  • A WinCC binary tag is available on the OS that the SFC can write to. The recommended naming convention is <SFC instance>_<step>_OpenFP for clarity in tag diagnostics.
  • The WinCC C compiler is installed if Method 1 or 2 is used (default for PCS 7 ES). Verify via the WinCC Explorer: Tools → C-Editor should launch without complaint.
  • The apdefap.h header is in the WinCC include path. Default location: C:\Program Files\Siemens\Automation\WinCC\aplib\apdefap.h on the ES.
Note on operator authorisation. The faceplate is opened by the SFC at the request of the procedure, not by the operator. In a safety-critical process, consider gating the SFC-driven opening with an authorisation level so that the faceplate cannot be opened automatically when the user is logged out. The SFC step property "Operator Dialog" can carry the authorisation flag.

4. Method 1: C-Action with PCS7_OpenGroupDisplay_V6

4.1 Function reference

The OpenGroupDisplay function family in PCS 7 V7.1 follows this naming pattern:

OpenGroupDisplay function variants
Function Minimum OS version Notes
PCS7_OpenGroupDisplay_V6 WinCC V6.0 / PCS 7 V6.0 Original API, still present in V7.x for compatibility
PCS7_OpenGroupDisplay_V7 WinCC V7.0 / PCS 7 V7.0+ Recommended for V7.1 projects; added message-line support
PCS7_OpenSFCGroupDisplay PCS 7 V7.0+ Used by SFC Visualization for step-driven faceplate opening

For PCS 7 V7.1, use PCS7_OpenGroupDisplay_V7 for new code; the V6 variant is documented here because the wiring is for an existing custom block whose block icon was created in an earlier PCS 7 release. Both functions accept the same two LPCTSTR parameters and resolve the faceplate PDL through the Group Display property of the named block icon.

4.2 Compiler error 0040: "')' expected"

The most common syntax defect when authors paste a C-action for the first time is a missing closing parenthesis. The MSVC compiler that WinCC uses reports this as warning or error 0040 with the message "')' expected before <next token>". The faulty code in the original post was:

#include "apdefap.h"
void OnPropertyChanged(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, BOOL value)
{
#define QTRIG ".Q_TRIG"
if (GetTagBit(QTRIG) == 1
PCS7_OpenGroupDisplay_V6(lpszPictureName, lpszObjectName );
}

The defect is on the line if (GetTagBit(QTRIG) == 1: the opening parenthesis after if is never closed. The next line, beginning PCS7_OpenGroupDisplay_V6, is then parsed as a continuation of the condition, which is syntactically invalid. The error message "0040: ')' expected before PCS7_OpenGroupDisplay..." is the compiler asking for the missing parenthesis.

There is also a second, less obvious defect: the #define directive is placed inside the function body, which is valid C but the macro is then textually expanded inside the function. For a tag access via GetTagBit, the macro must produce a string literal, and the leading dot in ".Q_TRIG" is only meaningful when the tag prefix is implicit. If the tag is qualified, the dot must not be present. The corrected C-action is shown next.

4.3 Corrected C-action

Drop the #define from inside the function and write the tag name in full:

#include "apdefap.h"

void OnPropertyChanged(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, BOOL value)
{
    if (GetTagBit("SFC_FP_TRIG") == 1)
    {
        PCS7_OpenGroupDisplay_V6(lpszPictureName, lpszObjectName);
    }
}

Behaviour: the Change event fires on every transition of the bound property, and the body only opens the faceplate when the trigger tag is logically TRUE. The SFC must hold the tag at TRUE while the faceplate is requested and reset it to FALSE only after the faceplate has been opened and dismissed.

4.4 Single-shot opening with rising-edge detection

The corrected code above still has a subtle defect: the C-action will fire twice when the SFC drives the trigger from 0→1 and later resets from 1→0. The first opening is wanted; the second is not. Two ways to suppress the second opening:

Option A: gate on the value argument of OnPropertyChanged. The fourth argument is the new value of the property after the change. By checking that the new value is TRUE, the body only runs on the rising edge:

#include "apdefap.h"

void OnPropertyChanged(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, BOOL value)
{
    if (value == TRUE)
    {
        PCS7_OpenGroupDisplay_V6(lpszPictureName, lpszObjectName);
    }
}

This is the cleanest single-shot approach. The first transition (FALSE→TRUE) opens the faceplate. The second transition (TRUE→FALSE) is ignored. No CFC Q_TRIG block is required.

Option B: drive a Q_TRIG tag from CFC and check it in the C-action. Place a Q_TRIG (rising-edge) block in the CFC chart feeding the trigger tag. The Q_TRIG output is TRUE for exactly one AS cycle on the rising edge, FALSE thereafter. The C-action then only fires on the one-shot pulse:

#include "apdefap.h"

void OnPropertyChanged(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, BOOL value)
{
    if (GetTagBit("SFC_FP_QTRIG") == 1)
    {
        PCS7_OpenGroupDisplay_V6(lpszPictureName, lpszObjectName);
    }
}

The Q_TRIG block is configured in the CFC chart with the input connected to the operator command or SFC step condition and the output connected to the OS-visible tag SFC_FP_QTRIG. The advantage of Option B is that the single-shot behaviour is visible in the CFC chart and audit-friendly; the disadvantage is the extra CFC block and the OS scan-time dependency.

Watch the OS acquisition cycle. The WinCC runtime polls OS-visible tags at the configured acquisition cycle (default 1 s). A Q_TRIG pulse shorter than one cycle can be missed. For Q_TRIG-driven auto-open, configure the trigger tag as "S7_MELD" or "CFC_OP" acquisition, with the relevant CFC cycle time of 100 ms, and verify the pulse width in the CFC online view.

5. Method 2: Picture Window Fallback (Recommended)

The Picture Window approach avoids the C runtime entirely. The faceplate PDL is displayed inside a Picture Window object on the target picture. The Picture Window has two relevant properties:

  • Picture Name — set dynamically to the faceplate PDL file name (e.g. @MyBlock_1\Standard.PDL) when the window should be visible.
  • Display (visible) — set dynamically to a boolean tag (e.g. SFC_ShowFP). When the tag is TRUE, the window is visible; when FALSE, it is hidden.

The SFC then controls the two tags:

  1. On entering the operator-dialog step, set SFC_ShowFP to TRUE.
  2. Place a "Close" button on the faceplate that resets SFC_ShowFP to FALSE when the operator clicks OK or Cancel.
  3. On the SFC transition out of the step, wait for SFC_ShowFP == FALSE before proceeding.

Advantages over the C-action approach:

  • No C compiler dependency; the C-action can be deleted entirely.
  • OS download and project regeneration are faster and less error-prone.
  • The Picture Window position, size, and title can be set as picture properties and animated by the engineer without C code.
  • Multiple instances of the same faceplate can be displayed simultaneously on different unit pictures by using multiple Picture Windows bound to different instances.

Disadvantages:

  • The Picture Window approach is bound to a specific picture (the one containing the Picture Window), whereas the C-action can be called from any picture and pops the faceplate on top.
  • The Picture Window does not automatically "dock" the faceplate; the operator cannot drag it. Use the Picture Window's "Adapt Picture" and "Adapt Size" properties if the faceplate geometry must be matched.
C-action vs Picture Window comparison
Criterion C-action + OpenGroupDisplay Picture Window
Requires C runtime Yes No
Single-shot support Manual (Q_TRIG or value gate) Inherent (Display tag is level, not edge)
Positioning System handles docking Engineer-defined rectangle
Reusability across pictures Yes, called from any picture No, one Picture Window per picture
Project regeneration Slow; C-action must be re-bound Fast; only tag bindings
Troubleshooting GDK debugger required Tag online view sufficient

6. Configuring the Custom Block Icon

Before the C-action or Picture Window can be wired, the custom block icon must have at least one user-defined property that the SFC can drive. The standard block icons delivered with PCS 7 already have a "Display" or "AdditionalDisplay" property; custom blocks need it added explicitly via the Configuration Dialog.

6.1 Opening the Configuration Dialog

  1. In WinCC Explorer, navigate to the picture that contains the block icon (e.g. Unit_Overview.PDL).
  2. Right-click the block icon and choose Configuration Dialog from the context menu. If the menu item is missing, the block icon was not created via the Faceplate Designer and must be recreated.
  3. The dialog opens with the General tab active. Switch to the Miscellaneous tab.

6.2 Adding a custom "Display" property

  1. In the Miscellaneous tab, click New to add a new property. Name it Display1 (the exact name is referenced by the C-action).
  2. Set the property type to Boolean. The type controls what value range the Dynamic Dialog will offer.
  3. Confirm with OK. The new property appears in the block icon's property list.

6.3 Wiring a Dynamic Dialog to a CFC tag

  1. Select the block icon. In the Properties pane, locate the new Display1 property.
  2. Right-click the value column next to Display1 and choose Dynamic Dialog.
  3. Configure the dialog: expression = WinCC tag SFC_ShowFP (binary), result type = Boolean, and the lookup table TRUE = "1" / FALSE = "0" with the standard "Direct" mapping.
  4. Confirm with OK. The lightning-bolt icon appears next to the property, indicating a dynamic binding.

6.4 Wiring the C-action on the Change event

  1. With the block icon still selected, open the Events tab of the Properties pane.
  2. Navigate to Miscellaneous → Display1. The Change event is the default.
  3. Right-click the Change event and choose C-Action. The C-Editor opens with a skeleton OnPropertyChanged callback.
  4. Paste the corrected code from section 4.3 or 4.4.
  5. Compile (Ctrl+F7 in the C-Editor). The status bar at the bottom of the C-Editor must show "0 errors, 0 warnings" before the action is saved.
C-action compile must succeed before the picture is saved. WinCC silently discards a C-action that has unresolved compile errors at picture-save time, and the next picture open shows the Change event with no C-action attached. Always check the compile output, not just the C-Editor status bar.

7. Step-by-Step Commissioning Procedure

Use this procedure to bring up the auto-open faceplate from SFC in a PCS 7 V7.1 project.

  1. Author the faceplate. Open the custom CFC block in the Faceplate Designer and complete the standard view, message view, and trend view. Compile the block and run "Generate / Update Block Icons". Verify the faceplate opens with a manual click on the block icon before adding automation.
  2. Place the block icon. In the target unit picture, drop one block icon of the custom block. Confirm the click-to-open behaviour is correct.
  3. Define the trigger tag. In the WinCC Tag Management, add a binary tag SFC_FP_TRIG (internal tag if the trigger is purely OS-side; external tag with S7 connection if the trigger originates in CFC). Acquisition: "On change" for event-driven, "Cyclic" with 1 s for periodic, "S7_MELD" for SFC-driven.
  4. Wire the SFC to the tag. In the SFC plan, on the step that requires operator input, add a step output that sets the trigger tag to 1 on step entry. The transition out of the step should wait for a separate "faceplate closed" condition, e.g. an OK button on the faceplate that resets a "faceplate closed" tag, or a configurable dwell time.
  5. Add the custom property on the block icon. Follow section 6.1 to 6.3 to add a Display1 property and bind it to the trigger tag via Dynamic Dialog.
  6. Wire the C-action. Follow section 6.4 to attach the corrected OnPropertyChanged callback to the Display1 Change event.
  7. Compile and download. In WinCC Explorer, run Compiler → C-Editor → Compile All. Then run the OS project editor and download to the OS runtime.
  8. Verify on the runtime OS. Switch to process mode, force the trigger tag to 1 from the SFC (or from the WinCC tag simulation), and confirm the faceplate opens exactly once. Force the trigger back to 0 and confirm no second opening occurs.
  9. Test operator authorisation. Log out, repeat the trigger, and confirm that the SFC is rejected at the transition (or the faceplate opens read-only, depending on configuration).
  10. Archive. Export the OS project, the CFC chart, the SFC plan, and the faceplate PDL into the project archive. Save the C-action source separately in the ES source control system.

8. Verification

After commissioning, run the following verification checks at the OS runtime:

Verification checklist
Check Procedure Expected result
Manual click still works Click the block icon Faceplate opens on top of current picture, standard view active
Single trigger from SFC Set SFC_FP_TRIG from 0 to 1 in tag simulation Faceplate opens exactly once
Reset does not re-open Set SFC_FP_TRIG from 1 to 0 No new faceplate opens; existing one stays in place
Operator close continues SFC Close the faceplate via OK button SFC transitions to the next step; "faceplate closed" tag is set
Authorisation gate Log out, repeat trigger SFC rejected at transition; or faceplate opens in read-only mode
Multi-instance behaviour Open faceplate for block A, then trigger faceplate for block B from a different SFC Block A faceplate is replaced by block B faceplate, no memory leak
OS download resilience Download OS project, restart OS runtime All bindings re-attached; C-action still compiled and bound

For audit purposes, run the verification in the QA test environment with WinCC Channel Diagnostics enabled. The "Graphics Designer" diagnostic view shows the binding chain (Picture → Property → Tag) and the "Tag Online" view shows the live trigger value. Both should agree on the trigger path. The PCS 7 V7.1 service pack release notes (see Siemens Industry Online Support) list known issues with C-action regeneration on incremental OS download; the fix is a full "Compile → Download" cycle after any change to the C-action source.

9. Troubleshooting Matrix

Symptom → cause → remedy
Symptom Likely cause Remedy
Compiler error 0040: "')' expected before PCS7_OpenGroupDisplay..." Missing closing parenthesis on the if statement Add ) after the condition, before the function call
C-action compiles but does nothing at runtime C-action not attached to the Change event, or saved before compile Open the Change event, recompile, save the picture, redownload
Faceplate opens twice (on 0→1 and 1→0) C-action has no edge detection; SFC resets the trigger Add the if (value == TRUE) gate or use a CFC Q_TRIG block
Faceplate never opens Group Display property of the block icon is empty Re-run Faceplate Designer "Generate Block Icon" for the custom block
Faceplate opens behind the active picture Picture Window z-order is below; the OnPropertyChanged call does not raise the picture Bring the active picture to front in the C-action with SetForegroundWindow, or use Picture Window approach
Block icon shows a line in the wrong place Custom "Display" property of a line is bound to a level tag but the line is drawn with the default geometry Open the Configuration Dialog and verify the property is bound to the line object, not the icon background
SFC transitions through the step without waiting Transition condition does not reference the "faceplate closed" tag Add the closed tag to the transition; configure the OK button on the faceplate to set it
Operator can close the faceplate but the SFC never progresses OK button only sets a local WinCC variable, not a WinCC tag visible to AS Use a tag with S7 connection for the "faceplate closed" signal
Faceplate flashes on every AS scan Trigger is a level signal at 1 Hz from the CFC chart, not a Q_TRIG pulse Insert a Q_TRIG block in CFC; pulse width must be at least the OS acquisition cycle
apdefap.h not found at compile time WinCC C-Editor include path is misconfigured Add C:\Program Files\Siemens\Automation\WinCC\aplib\ to the C-Editor include path under Tools → Options → Directories

10. Frequently Asked Questions

Why does the faceplate open twice when the SFC sets the trigger from 0 to 1 and then from 1 to 0?

The Change event on a boolean property fires on both edges. The C-action body runs on each fire, and PCS7_OpenGroupDisplay_V6 is called twice. Add a rising-edge gate — either the if (value == TRUE) check on the OnPropertyChanged argument, or a CFC Q_TRIG block driving the trigger tag — so that the body only runs on the 0→1 transition.

What is the exact signature of PCS7_OpenGroupDisplay_V6 and which include is required?

The function is declared in apdefap.h as void PCS7_OpenGroupDisplay_V6(LPCTSTR lpszPictureName, LPCTSTR lpszObjectName);. The first argument is the picture containing the block icon, the second is the block icon object name. The function reads the "Group Display" property of the block icon and opens the matching faceplate PDL in standard view.

How do I resolve C compiler error 0040: "')' expected before PCS7_OpenGroupDisplay..."?

The defect is a missing closing parenthesis on the if condition. Add ) immediately after the comparison expression, before the call to PCS7_OpenGroupDisplay_V6. After the fix, compile with Ctrl+F7 in the C-Editor and confirm "0 errors, 0 warnings" before saving the picture.

Can I open a faceplate from SFC without writing any C code?

Yes. Use a Picture Window on the target unit picture: bind its "Picture Name" property to a constant string identifying the faceplate PDL, and bind its "Display" (visible) property to a binary WinCC tag. The SFC sets the tag to TRUE on step entry, the faceplate appears; the operator clicks OK on the faceplate, which resets the tag, and the SFC transitions to the next step.

How do I pass setpoint values from the SFC into the faceplate?

The faceplate reads its inputs from the AS-side block instance via standard OS tag mapping. The SFC step output should write the desired setpoint to the corresponding input tag of the block (e.g. SP_INT or SP_EXT) before triggering the faceplate to open. The faceplate then displays the current setpoint value and the operator can confirm or override it. Override values are written back through the standard operator-input pathway.

Back to blog