====== lamaLibrary: bitsToByte ====== The function 8 bits JOIN to a byte. Function call: "bitsToByte"(bit00:=_bool_in_, bit01:=_bool_in_, bit02:=_bool_in_, bit03:=_bool_in_, bit04:=_bool_in_, bit05:=_bool_in_, bit06:=_bool_in_, bit07:=_bool_in_, OUT=>_byte_out_); Source code: TITLE = JOIN A BYTE FROM BITS { S7_Optimized_Access := 'FALSE' } AUTHOR : lamaLibrary FAMILY : TOOLS VERSION : 0.1 //Build a word, bit-by-bit VAR_INPUT bit00 : Bool; // Bit 00 of BYTE bit01 : Bool; // Bit 01 of BYTE bit02 : Bool; // Bit 02 of BYTE bit03 : Bool; // Bit 03 of BYTE bit04 : Bool; // Bit 04 of BYTE bit05 : Bool; // Bit 05 of BYTE bit06 : Bool; // Bit 06 of BYTE bit07 : Bool; // Bit 07 of BYTE END_VAR VAR_OUTPUT OUT : Byte; // Word constructed from bits END_VAR BEGIN // Assemble bits to a byte #OUT.%X0 := #bit00; #OUT.%X1 := #bit01; #OUT.%X2 := #bit02; #OUT.%X3 := #bit03; #OUT.%X4 := #bit04; #OUT.%X5 := #bit05; #OUT.%X6 := #bit06; #OUT.%X7 := #bit07; END_FUNCTION {{:download:bitstobyte.scl|Join bits to byte (SCL) Download}} Main site > [[simatic:lamalib|LamaLibrary Simatic]] ===== lamaLibSimatic topics on lamaPLC ===== {{topic>lamaLibSimatic}} {{tag>TIA SCL lamaLibSimatic source_code join bits byte convert}} \\ This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}}