Converting Fieldbus BYTE Inputs to Individual Binary Bits in PCS 7 CFC - Block Selection and Library Placement

Converting Fieldbus BYTE Inputs to Individual Binary Bits in PCS 7 CFC - Block Selection and Library Placement

To convert an 8-bit BYTE process variable—such as feedback from Foundation Fieldbus or PROFIBUS Motor Operated Valves (MOVs)—into individual binary BOOL signals in SIMATIC PCS 7 CFC, use the standard conversion block BY_BO. Block BY_BO accepts a single BYTE at input IN and unpacks it into eight discrete Boolean outputs (Q0 through Q7). In the CFC catalog, locate BY_BO under the 'Blocks' tab within the 'CONVERT' family. If BY_BO is not visible in the active project catalog, open the standard CFC Library (File > Open > Libraries > CFC Library) and copy block BY_BO (FB44/FC) directly into your project's S7 block folder.

Table of Contents

Executive Summary

Integrating intelligent field devices—such as Foundation Fieldbus (FF) actuators, PROFIBUS PA Motor Operated Valves (MOVs), or Modbus RTU variable frequency drives—into SIMATIC PCS 7 frequently presents data format mismatches. While field instruments package operational states (e.g. Opened, Closed, Torque Fault, Local Mode, Jammed) into packed 8-bit BYTE or 16-bit WORD registers to minimize bus bandwidth, PCS 7 technological blocks (such as MotL, VlvL, or MonDiL) require discrete Boolean (BOOL) signals for interlocks and feedback monitoring. Automation engineers searching the CFC library catalog often struggle to find the appropriate bit extraction block. This guide details the block selection, library retrieval procedure, and parameter mapping for bit unpacking in PCS 7.

Fieldbus Device Integration: Packed Bytes vs Discrete Signals

Fieldbus communication profiles (such as Foundation Fieldbus Transducer Blocks or PROFIBUS Profile for Process Control Devices) structure digital status information into compact bit masks. For instance, in a typical MOV actuator:

  • Bit 0 (LSB): Valve fully Closed feedback.
  • Bit 1: Valve fully Open feedback.
  • Bit 2: Torque limit switch triggered in closing direction.
  • Bit 3: Torque limit switch triggered in opening direction.
  • Bit 4: Actuator operating in Local/Hand mode.
  • Bit 5: General actuator fault / Alarm.

When a channel driver or communication block outputs this packed register as data type BYTE, it cannot be wired directly to VlvL.FbkOpen or VlvL.FbkClose, which strictly expect elementary BOOL or structured Struct inputs.

Functional Mechanics of Conversion Block BY_BO

The elementary conversion block BY_BO (Byte to Boolean, FB44 or FC in CFC Library) provides transparent bit extraction:

  • Input IN (BYTE): The 8-bit input variable to be unpacked.
  • Outputs Q0 to Q7 (BOOL): Individual discrete bits, where Q0 represents Bit 0 (least significant bit, weight 2^0) and Q7 represents Bit 7 (most significant bit, weight 2^7).

The block executes simple bitwise shifting and masking with minimal CPU cycle overhead, making it ideal for cyclic execution in high-frequency interrupt OBs (OB35 / 100 ms).

Alternative Unpacking Blocks in PCS 7 Libraries

Depending on data word width and library version, alternative blocks exist in PCS 7:

  • W_BO (Word to Boolean): Unpacks a 16-bit WORD into 16 discrete outputs (Q0 to Q15).
  • DW_BO (Double Word to Boolean): Unpacks a 32-bit DWORD into 32 discrete outputs (Q0 to Q31).
  • BitsToByte / ByteToBits (APL Elementary Blocks): Modern APL utility blocks that unpack bytes while supporting signal status propagation.
  • Custom SCL FC: A custom function using slice access (ByteVar.%X0 in modern compilers, or bit masking logic in classic SCL).

Bit Conversion Block Family Comparison

The following table compares the conversion blocks available in standard SIMATIC PCS 7 libraries:

Block NameLibrary SourceInput Data TypeOutput Data TypeExecution OverheadPrimary Application ScopeBY_BOCFC Standard LibraryBYTE (8 bits)8x BOOL (Q0..Q7)Extremely Low (~20 instructions)Unpacking 8-bit MOV/actuator status bytes.W_BOCFC Standard LibraryWORD (16 bits)16x BOOL (Q0..Q15)Extremely Low (~35 instructions)Unpacking 16-bit drive status words (e.g. VFD).DW_BOCFC Standard LibraryDWORD (32 bits)32x BOOL (Q0..Q31)Very Low (~60 instructions)Unpacking 32-bit telemetry or alarm bitmasks.BO_BYCFC Standard Library8x BOOL (IN0..IN7)BYTE (8 bits)Extremely LowPacking 8 discrete bits into a single byte.BitsToBytePCS 7 AP Library8x BOOLBYTE + Signal StatusLowModern APL structured signal packaging.

Step-by-Step Implementation Procedure in CFC

Method 1: Importing and Placing BY_BO in CFC

  1. Open the CFC chart in SIMATIC Manager.
  2. In the CFC catalog (left pane), click the Blocks tab.
  3. Expand the folder CONVERT and look for BY_BO.
  4. If BY_BO is missing from the list:
    a. In SIMATIC Manager, select File > Open > Libraries.
    b. Select CFC Library and click OK.
    c. Expand CFC Library > S7 Program > Blocks.
    d. Locate block BY_BO (FB44 / FC).
    e. Drag or copy BY_BO into your active PCS 7 project's offline block folder.
    f. In the CFC editor, select Options > Update Block Types.
  5. Drag BY_BO onto the CFC chart.
  6. Interconnect the fieldbus device output byte to BY_BO.IN.
  7. Interconnect BY_BO.Q0 (Closed) and BY_BO.Q1 (Open) to the appropriate technological block inputs (e.g. VlvL.FbkClose and VlvL.FbkOpen).
  8. Compile CFC changes and download to the AS controller.

Verification

To verify that bit extraction functions accurately in runtime:

  1. CFC Test Mode: Switch the CFC editor to Test Mode (Debug > Test Mode).
  2. Bit State Verification: In the field or via simulation, force the MOV to the Closed position (byte value = 16#01). Confirm that BY_BO.IN reads 16#01, Q0 evaluates to TRUE (1), and outputs Q1 through Q7 evaluate to FALSE (0).
  3. Technological Response: Confirm that the downstream valve block (VlvL) reflects the closed state without discrepancy alarms.

Limitations and Operational Precautions

  • Bit Weighting and Endianness: Ensure that the field device's bit assignment conforms to standard Siemens bit ordering (Bit 0 = LSB, Bit 7 = MSB). Some non-standard Modbus devices reverse bit significance within bytes.
  • No Signal Status Carryover: Elementary blocks like BY_BO process raw bits without Signal Status (ST) metadata. When connecting Q0 to APL structured inputs, the CFC auto-wrapper sets ST = 16#80 (Good). Ensure fieldbus communication watchdog logic is implemented.
  • Process Object Licensing: Using elementary utility blocks such as BY_BO does not consume AS Process Object (PO) runtime licenses.

Engineer FAQ

Does BY_BO consume an AS Process Object (PO) license in PCS 7?

No. Elementary mathematical, conversion, and bit-logic blocks from the standard CFC Library do not count toward Process Object license consumption.

What should I do if the field device sends a 16-bit WORD instead of a BYTE?

Use block W_BO from the CONVERT family in the CFC library; it accepts a 16-bit WORD and unpacks it into sixteen discrete Boolean outputs (Q0 to Q15).

Can I reverse the process and pack eight bits into a single byte?

Yes, use block BO_BY from the same CONVERT family; it takes eight BOOL inputs (IN0 through IN7) and packs them into a single BYTE output.

Technical References

Related Articles

Related Tags

  • https://industrialautomation.net/search?query=simatic-pcs7
  • https://industrialautomation.net/search?query=cfc-editor
  • https://industrialautomation.net/search?query=data-conversion
  • https://industrialautomation.net/search?query=fieldbus
6 respuestas