Decoding and Commanding PCS 7 SFCs via the SFC_CONTROL Interface Word

Decoding and Commanding PCS 7 SFCs via the SFC_CONTROL Interface Word

In SIMATIC PCS 7, controlling Sequential Function Charts (SFC charts and SFC types) from external systems, custom CFC logic, or third-party HMIs without using the proprietary WinCC SFC Visualization ActiveX control is achieved via the 32-bit input control word SFC_CONTROL. Paired with the status output word SFC_STATE, SFC_CONTROL accepts bit-encoded command pulses that execute sequential state machine transitions (such as Start, Hold, Resume, Abort, Stop, and Reset) and operating mode changes (Manual vs Automatic). To execute a command, the target command bit must be pulsed high for at least one execution cycle while the SFC is in a valid receptive operating state.

Table of Contents

Architecture of SFC External Control Interfaces

In SIMATIC PCS 7, Sequential Function Charts (SFC) provide structured sequential and batch phase execution following the ISA-88 / NAMUR state model. While standard PCS 7 operator stations interact with SFCs via the pre-built WinCC SFC Visualization package, engineering projects frequently require controlling SFC sequences through alternative channels:

  1. Autonomous inter-controller handshakes across S7 or Modbus connections.
  2. Third-party local operator panels (such as SIMATIC Basic Panels or third-party SCADA systems).
  3. Advanced supervisory coordinating charts in CFC.

To support external programmatic control, the SFC runtime system (FB246 / SFC Type instances) exposes two standardized 32-bit interface words: SFC_CONTROL (inputs from control authority) and SFC_STATE (outputs indicating active state and operating mode).

Bitmask Decoding and Command Mapping for SFC_CONTROL

The SFC_CONTROL input is a 32-bit DWORD where individual bits trigger discrete state transitions. Because official documentation provides limited parameter descriptions, the table below provides the verified bitmask mapping:

Bit IndexHex MaskCommand MnemonicOperational State Transition TriggeredBit 016#00000001STARTStarts the SFC from Idle / Ready stateBit 116#00000002HOLDInterrupts execution; transitions to Holding -> HeldBit 216#00000004RESUMEResumes execution from Held state -> ResumingBit 316#00000008PAUSEPauses sequence after current active step completesBit 416#00000010CONTContinues execution from Paused stateBit 516#00000020ABORTImmediate emergency stop; transitions to Aborting -> AbortedBit 616#00000040STOPControlled shutdown; transitions to Stopping -> StoppedBit 716#00000080RESTARTRestarts execution from Stopped or Aborted stateBit 816#00000100RESETClears completed/stopped states; transitions back to IdleBit 1616#00010000MANUALSwitches SFC operating mode to ManualBit 1716#00020000AUTOSwitches SFC operating mode to Automatic

All command bits operate on rising-edge or single-cycle pulse evaluation. Writing a static 1 without resetting the bit will lock that command active, preventing subsequent state transitions.

Coordinating Commands with SFC_STATE Status Monitoring

Before asserting a command on SFC_CONTROL, the supervising program or HMI script must inspect SFC_STATE to confirm that the state machine is in a receptive condition:

  • Idle (State 1): Accepts START (Bit 0).
  • Running (State 3): Accepts HOLD (Bit 1), PAUSE (Bit 3), STOP (Bit 6), or ABORT (Bit 5).
  • Held (State 5): Accepts RESUME (Bit 2) or ABORT (Bit 5).
  • Completed (State 11): Accepts RESET (Bit 8).

Attempting to issue RESUME while the SFC is actively Running or issuing START while in Aborting will be rejected by the internal SFC sequencer.

CFC and Third-Party HMI Implementation Guidelines

To command an SFC from a third-party HMI or external CFC logic:

  1. Pulse Logic: In CFC, utilize pulse generation blocks (such as Pulse or R_TRIG) to ensure that command bits are asserted for exactly one execution cycle (e.g., 100 ms in OB35).
  2. Third-Party HMI Pushbuttons: In WinCC Comfort or third-party SCADA:
    - Configure button events using 'SetBitInTag' on button press, and 'ResetBitInTag' on button release.
    - Alternatively, write a brief VBS script that reads SFC_CONTROL, performs a bitwise OR with the command mask, waits 200 ms, and performs a bitwise AND with the inverted mask to reset the bit.
  3. Operating Mode Interlocks: Ensure that the SFC is switched to Manual mode (Bit 16 = 1) if manual operator stepping or external commands are required, or configure the SFC instance parameter ENASTART = 1.

Verification

To verify SFC control via SFC_CONTROL:
1. In CFC Editor, open the chart containing the SFC instance in online test mode.
2. In the SFC window, verify the state is Idle (SFC_STATE = 1).
3. Using CFC online forcing or an HMI button, pulse SFC_CONTROL = 16#00000001 (Start command).
4. Verify that the SFC transitions immediately to Starting -> Running, and that step timers begin advancing.
5. Pulse SFC_CONTROL = 16#00000002 (Hold command); verify that the SFC halts at the current step and reports status Held.

Limitations and Operational Precautions

Never write multiple conflicting command bits simultaneously to SFC_CONTROL (e.g., asserting START and STOP in the same word). If conflicting bits are written, the SFC priority logic executes the highest safety priority command (typically ABORT or STOP). Ensure safety-critical emergency stops are hardwired or routed through dedicated safety interlock pins (INTLOCK), rather than relying solely on software SFC_CONTROL words.

Engineer FAQ

Can SFC_CONTROL be used while the SFC is in Automatic mode?

Certain commands (like ABORT or STOP) can execute in Automatic mode depending on configured permissions, but operational stepping and manual starts typically require switching to Manual mode (Bit 16 = 1).

Why did my Start command fail to start the SFC?

The SFC may have unsatisfied start interlocks (ENASTART = 0), or the previous batch execution may not have been reset (RESET command Bit 8 required to return Completed SFCs to Idle).

What block handles SFC type instance execution in S7-400?

SFC types are executed by compiled function blocks generated from the SFC Editor, typically utilizing system runtime FB246.

Technical References

Related Articles

Related Tags

  • SFC_CONTROL
  • SFC_STATE
  • Sequential Function Chart
  • Third-Party HMI
  • Command Word
6 respuestas