Configuring SFC14 and SFC15 for Consistent Peripheral Data Exchange with DP Slaves in PCS 7
In SIMATIC PCS 7 and STEP 7, exchanging data records exceeding 4 contiguous bytes (DWORD) with PROFIBUS DP slaves—such as Atlas Copco compressor ComBox-P interfaces—requires using system function blocks SFC14 (DPRD_DAT) and SFC15 (DPWR_DAT). While S7-400 CPUs natively guarantee data consistency up to 4 bytes via standard load and transfer instructions, larger multivariable telegrams configured with Total Length consistency must be transferred via SFC14 and SFC15 to prevent data tearing during asynchronous cyclic communication updates.
Table of Contents
- Data Consistency Rules in S7-400 and PCS 7 Controllers
- HW Config Configuration for Third-Party DP Slaves
- Step-by-Step Programming of SFC14 (DPRD_DAT) in CFC
- Step-by-Step Programming of SFC15 (DPWR_DAT) in CFC
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
Data Consistency Rules in S7-400 and PCS 7 Controllers
In SIMATIC S7-400 controllers, data consistency defines whether a multi-byte dataset can be read or written by the CPU operating system as an indivisible unit without being interrupted by higher-priority cyclic interrupt organization blocks (e.g., OB35):
- Basic Consistency (1, 2, or 4 Bytes): S7-400 controllers natively guarantee consistency for Byte, Word (2 bytes), and Double Word (4 bytes /
DWORD) using standard peripheral instructions (L PIW,T PQW,L PID). - Total Length Consistency (> 4 Bytes): Intelligent field devices—such as compressor controllers (Atlas Copco Elektronikon / ComBox-P), motor drives, and energy meters—frequently exchange telegrams consisting of 6, 8, 16, or 32 contiguous bytes containing floating-point values, status words, and timestamped alarms.
- The Risk of Data Tearing: If an engineer attempts to read an 8-byte telegram using two separate
DWORDreads, an interrupt organization block may execute between the two reads, resulting in an inconsistent hybrid dataset where the first 4 bytes reflect the new cycle and the second 4 bytes reflect the old cycle.
To ensure atomic data exchange across telegrams configured with "Total Length" consistency, STEP 7 provides standard system functions:
* SFC14 (DPRD_DAT): Read Consistent Data from a DP Standard Slave.
* SFC15 (DPWR_DAT): Write Consistent Data to a DP Standard Slave.
HW Config Configuration for Third-Party DP Slaves
Before programming in CFC, configure the slave module in STEP 7 HW Config:
- GSD Installation:
* Obtain the manufacturer-certified GSD file (e.g.,ComBox-P.gsdfor Atlas Copco).
* In HW Config, selectOptions -> Install GSD File...and browse to the extracted file. - Add Slave to DP Master System:
* Locate the slave in the catalog underPROFIBUS DP -> Additional Field Devices -> General.
* Drag the slave onto the CPU or CP 443-5 PROFIBUS DP network.
* Assign the physical PROFIBUS station address. - Module Sizing and Consistency Assignment:
* Insert the appropriate input/output module (e.g.,8 Bytes In / 8 Bytes Outor4 Words Consistent).
* Double-click the configured slot to inspect its properties.
* Verify that Consistency is explicitly set to Total Length (not Unit).
* Note the start address in the input table (e.g.,PIW 512) and output table (e.g.,PQW 512). Convert this decimal address to hexadecimal (e.g.,512decimal =16#200).
Step-by-Step Programming of SFC14 (DPRD_DAT) in CFC
To read data consistently from the slave in Continuous Function Chart (CFC):
- Instantiate SFC14:
* In the CFC library browser, locateSFC14(DPRD_DAT) underSystem Function Blocks.
* DragSFC14into the cyclic interrupt chart (e.g., OB35 / 100 ms cycle). - Configure Block Parameters:
*LADDR(Input,WORD): Enter the hexadecimal base address of the configured DP slave input module. For base address512, enterW#16#200.
*RECORD(Output,ANYpointer): Assign the destination data structure. Create a dedicated data block (DB) with an array of bytes or structured variables matching the telegram length (e.g.,P#DB100.DBX0.0 BYTE 8). - Evaluate Execution Flags:
*RET_VAL(Output,INT): Evaluates error return codes (16#0000= Successful execution; non-zero codes indicate communication errors, e.g.,16#8090= invalid address,16#8092= ANY pointer length discrepancy).
Step-by-Step Programming of SFC15 (DPWR_DAT) in CFC
To write control words and setpoints consistently to the slave:
- Instantiate SFC15:
* DragSFC15(DPWR_DAT) into the CFC chart. - Configure Block Parameters:
*LADDR(Input,WORD): Enter the hexadecimal base address of the configured output module (e.g.,W#16#200forPQW 512).
*RECORD(Input,ANYpointer): Assign the source data structure containing command bits and setpoint words (e.g.,P#DB100.DBX10.0 BYTE 8). - Evaluate RET_VAL:
* MonitorRET_VALfor16#0000to confirm successful transmission to the DP slave output buffer.
Verification
Confirm consistent data communication:
- CFC Online Monitoring:
* Open the CFC chart in Test Mode.
* Verify thatSFC14.RET_VALandSFC15.RET_VALreport16#0000. - Telemetry Integrity Check:
* Open the destination DB in a variable table (VAT).
* Observe live parameters (e.g., compressor delivery pressure, oil temperature, motor current).
* Verify that multi-byte REAL values display stable floating-point numbers without glitching or bit shifts. - Diagnostic Buffer Audit:
* PressCtrl + Don the CPU to ensure no I/O access errors (OB122) or peripheral access faults are recorded.
Limitations and Operational Precautions
- Process Image Boundary: If the DP slave addresses fall inside the CPU cyclic Process Image Partition (PIP), modern S7-400 CPUs can update consistent data automatically if configured in HW Config, but utilizing SFC14/15 remains mandatory for addresses outside the process image or where explicit software consistency is configured.
- ANY Pointer Length Alignment: The length defined in the
RECORDparameter (e.g., 8 bytes) must match the exact byte length configured in HW Config for that slot; any mismatch causesSFC14/SFC15to abort with error code16#8092. - High Bus Cycle Loading: Calling dozens of SFC14/SFC15 instances in fast cyclic organization blocks (e.g., OB38 / 10 ms) increases controller CPU cycle time. Place block calls in appropriate slower cyclic OBs (e.g., OB35 / 100 ms or OB32 / 1 s).
Engineer FAQ
- When is it mandatory to use SFC14 and SFC15 instead of standard peripheral addressing?
Whenever a PROFIBUS DP or PROFINET module is configured with 'Total Length' consistency for data lengths exceeding 4 contiguous bytes. - What does parameter LADDR represent on SFC14 and SFC15?
LADDR is the logical base start address of the configured peripheral module, specified in hexadecimal format (e.g., input address 256 = W#16#100). - What does return code 16#8090 indicate on SFC14?
Error 16#8090 indicates that the address specified at LADDR is invalid or does not correspond to a configured DP slave module with total consistency. - What does return code 16#8092 mean on SFC15?
Error 16#8092 indicates that the length of the data structure specified in the RECORD parameter does not match the configured hardware slot length. - Can SFC14 and SFC15 be used with PROFINET IO devices?
Yes, SFC14 and SFC15 function identically for PROFINET IO devices configured with consistent data blocks exceeding 4 bytes. - Can I use SFC14/15 in SCL or custom FB code in PCS 7?
Yes, SFC14 and SFC15 can be called directly in SCL, STL, or instantiated as graphical blocks in Continuous Function Chart (CFC). - Does S7-400 support reading 4 bytes consistently without SFC14?
Yes, S7-400 controllers natively guarantee consistency up to 4 bytes (DWORD) using standard peripheral read instructions (PID). - What data type must be supplied to the RECORD parameter of SFC14?
An ANY pointer pointing to the target storage area (e.g., P#DB10.DBX0.0 BYTE 12). - Where can I find the GSD file for an Atlas Copco compressor?
The GSD file (such as ComBox-P or Elektronikon) is provided by Atlas Copco on their documentation media or support portal. - Does calling SFC14 stop controller execution if the slave disconnects?
No, SFC14 will not trigger a CPU STOP; it outputs an error code in RET_VAL, allowing user logic to handle the communication loss gracefully.
Technical References
- Siemens Industry Online Support (SIOS) Portal: How do you configure consistent data exchange with SFC14 and SFC15? (Entry ID: 19183490).
- SIMATIC S7-400 System Software for S7-300/400 System and Standard Functions Manual, Siemens AG.
- PROFIBUS DP Specification: Consistent Data Transmission Rules (IEC 61158).
Related Articles
- Accessing SIMOCODE Pro Cyclic Send and Receive Data in SIMATIC PCS 7
- Merging Two DWORD Energy Registers into REAL and LREAL Values in SIMATIC PCS 7
Related Tags
PCS 7, STEP 7, S7-400, SFC14, SFC15, PROFIBUS DP, Data Consistency, Atlas Copco, ComBox-P