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
- Fieldbus Device Integration: Packed Bytes vs Discrete Signals
- Functional Mechanics of Conversion Block BY_BO
- Alternative Unpacking Blocks in PCS 7 Libraries
- Bit Conversion Block Family Comparison
- Step-by-Step Implementation Procedure in CFC
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
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
Q0toQ7(BOOL): Individual discrete bits, whereQ0represents Bit 0 (least significant bit, weight 2^0) andQ7represents 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-bitWORDinto 16 discrete outputs (Q0toQ15).DW_BO(Double Word to Boolean): Unpacks a 32-bitDWORDinto 32 discrete outputs (Q0toQ31).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.%X0in 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:
BY_BOBYTE (8 bits)BOOL (Q0..Q7)W_BOWORD (16 bits)BOOL (Q0..Q15)DW_BODWORD (32 bits)BOOL (Q0..Q31)BO_BYBOOL (IN0..IN7)BYTE (8 bits)BitsToByteBOOLBYTE + Signal StatusStep-by-Step Implementation Procedure in CFC
Method 1: Importing and Placing BY_BO in CFC
- Open the CFC chart in SIMATIC Manager.
- In the CFC catalog (left pane), click the Blocks tab.
- Expand the folder CONVERT and look for
BY_BO. - If
BY_BOis 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 blockBY_BO(FB44 / FC).
e. Drag or copyBY_BOinto your active PCS 7 project's offline block folder.
f. In the CFC editor, select Options > Update Block Types. - Drag
BY_BOonto the CFC chart. - Interconnect the fieldbus device output byte to
BY_BO.IN. - Interconnect
BY_BO.Q0(Closed) andBY_BO.Q1(Open) to the appropriate technological block inputs (e.g.VlvL.FbkCloseandVlvL.FbkOpen). - Compile CFC changes and download to the AS controller.
Verification
To verify that bit extraction functions accurately in runtime:
- CFC Test Mode: Switch the CFC editor to Test Mode (Debug > Test Mode).
- Bit State Verification: In the field or via simulation, force the MOV to the Closed position (byte value =
16#01). Confirm thatBY_BO.INreads16#01,Q0evaluates toTRUE(1), and outputsQ1throughQ7evaluate toFALSE(0). - 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_BOprocess raw bits without Signal Status (ST) metadata. When connectingQ0to APL structured inputs, the CFC auto-wrapper setsST = 16#80(Good). Ensure fieldbus communication watchdog logic is implemented. - Process Object Licensing: Using elementary utility blocks such as
BY_BOdoes 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
- Siemens AG: SIMATIC Process Control System PCS 7 CFC for S7 / PCS 7 Manual (Doc No. A5E03415129)
- Siemens Industry Online Support Entry ID 109760968: SIMATIC PCS 7 Advanced Process Library Manual
- IEC 61131-3: Programmable Controllers - Standard Functions and Data Types
Related Articles
- https://industrialautomation.net/search?query=pcs7+cfc+by_bo+byte+to+bit+conversion
- https://industrialautomation.net/search?query=foundation+fieldbus+mov+actuator+pcs7
- https://industrialautomation.net/search?query=w_bo+word+to+bit+unpacking+cfc
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