2024年2月18日发(作者:冠华美)
VAR_OUTPUT O_LReal:LREAL;
END_VAR O_LReal := LITTLEBYTEARRAY_TO_ANYTYPE( byteArray := L_BYTE // ,offset := 0 ); ; END_FUNCTION_BLOCK //*********************FB_ByteTo_Bool********************** FUNCTION_BLOCK FB_ByteTo_Bool VAR ByteTo_8Bool : _BYTE_TO_8BOOL; END_VAR VAR_INPUT IB_Byte: BYTE; END_VAR VAR_OUTPUT O_Bool :ARRAY[0..7] OF BOOL; END_VAR ByteTo_8Bool( byteIn := IB_Byte ,bit0 => O_Bool[0] ,bit1 => O_Bool[1] ,bit2 => O_Bool[2] ,bit3 => O_Bool[3] ,bit4 => O_Bool[4] ,bit5 => O_Bool[5] ,bit6 => O_Bool[6] ,bit7 => O_Bool[7] );
END_FUNCTION_BLOCK //*********************FB_ByteTo_DWorde********************** FUNCTION_BLOCK FB_ByteTo_DWord VAR_INPUT ID_Byte :ARRAY[0..3]OF BYTE; END_VAR VAR_OUTPUT O_DWord :DWORD; END_VAR O_DWord := LITTLEBYTEARRAY_TO_ANYTYPE( byteArray := ID_Byte // ,offset := 0 ); END_FUNCTION_BLOCK //*********************FB_ByteTo_Int********************** FUNCTION_BLOCK FB_ByteTo_Int VAR_INPUT IN_Byte :ARRAY[0..1]OF BYTE; END_VAR VAR_OUTPUT O_Int :INT; END_VAR O_Int := LITTLEBYTEARRAY_TO_ANYTYPE( byteArray := IN_Byte // ,offset := 0 ); END_FUNCTION_BLOCK //*********************FB_ByteTo_Word********************** FUNCTION_BLOCK FB_ByteTo_Word VAR_INPUT IW_Byte :ARRAY[0..1]OF BYTE;
END_VAR VAR_OUTPUT O_Word :WORD; END_VAR O_Word := LITTLEBYTEARRAY_TO_ANYTYPE( byteArray := IW_Byte // ,offset := 0 ); END_FUNCTION_BLOCK //*********************FB_WordTo_Byte********************** FUNCTION_BLOCK FB_WordTo_Byte VAR_INPUT I_Word:WORD; END_VAR VAR_OUTPUT OW_Byte:ARRAY[0..1] OF BYTE; END_VAR OW_Byte := ANYTYPE_TO_LITTLEBYTEARRAY( anyData := I_Word
// ,offset := 0 ); END_FUNCTION_BLOCK //*********************FB_IntTo_Byte********************** FUNCTION_BLOCK FB_IntTo_Byte VAR_INPUT I_Int:INT; END_VAR VAR_OUTPUT ON_Byte:ARRAY[0..1] OF BYTE; END_VAR ON_Byte := ANYTYPE_TO_LITTLEBYTEARRAY( anyData := I_Int
// ,offset := 0 ); END_FUNCTION_BLOCK //*********************FB_DWordTo_Byte********************** FUNCTION_BLOCK FB_DWordTo_Byte VAR_INPUT I_DWord:DWORD; END_VAR VAR_OUTPUT OD_Byte:ARRAY[0..3] OF BYTE; END_VAR OD_Byte := ANYTYPE_TO_LITTLEBYTEARRAY( anyData := I_DWord
// ,offset := 0 ); END_FUNCTION_BLOCK //*********************FB_LRealTo_Byte********************** FUNCTION_BLOCK FB_LRealTo_Byte VAR_INPUT I_LReal:LREAL; END_VAR VAR_OUTPUT OL_Byte:ARRAY[0..7] OF BYTE; END_VAR OL_Byte := ANYTYPE_TO_LITTLEBYTEARRAY( anyData := I_LReal
// ,offset := 0 );
Bool_To_ByteByte_To_BoolByte_To_DWord
Byte_To_INTByte_To_LRealByte_To_Word
DWrod_To_ByteINT_To_ByteLReal_To_Byte
2024年2月18日发(作者:冠华美)
VAR_OUTPUT O_LReal:LREAL;
END_VAR O_LReal := LITTLEBYTEARRAY_TO_ANYTYPE( byteArray := L_BYTE // ,offset := 0 ); ; END_FUNCTION_BLOCK //*********************FB_ByteTo_Bool********************** FUNCTION_BLOCK FB_ByteTo_Bool VAR ByteTo_8Bool : _BYTE_TO_8BOOL; END_VAR VAR_INPUT IB_Byte: BYTE; END_VAR VAR_OUTPUT O_Bool :ARRAY[0..7] OF BOOL; END_VAR ByteTo_8Bool( byteIn := IB_Byte ,bit0 => O_Bool[0] ,bit1 => O_Bool[1] ,bit2 => O_Bool[2] ,bit3 => O_Bool[3] ,bit4 => O_Bool[4] ,bit5 => O_Bool[5] ,bit6 => O_Bool[6] ,bit7 => O_Bool[7] );
END_FUNCTION_BLOCK //*********************FB_ByteTo_DWorde********************** FUNCTION_BLOCK FB_ByteTo_DWord VAR_INPUT ID_Byte :ARRAY[0..3]OF BYTE; END_VAR VAR_OUTPUT O_DWord :DWORD; END_VAR O_DWord := LITTLEBYTEARRAY_TO_ANYTYPE( byteArray := ID_Byte // ,offset := 0 ); END_FUNCTION_BLOCK //*********************FB_ByteTo_Int********************** FUNCTION_BLOCK FB_ByteTo_Int VAR_INPUT IN_Byte :ARRAY[0..1]OF BYTE; END_VAR VAR_OUTPUT O_Int :INT; END_VAR O_Int := LITTLEBYTEARRAY_TO_ANYTYPE( byteArray := IN_Byte // ,offset := 0 ); END_FUNCTION_BLOCK //*********************FB_ByteTo_Word********************** FUNCTION_BLOCK FB_ByteTo_Word VAR_INPUT IW_Byte :ARRAY[0..1]OF BYTE;
END_VAR VAR_OUTPUT O_Word :WORD; END_VAR O_Word := LITTLEBYTEARRAY_TO_ANYTYPE( byteArray := IW_Byte // ,offset := 0 ); END_FUNCTION_BLOCK //*********************FB_WordTo_Byte********************** FUNCTION_BLOCK FB_WordTo_Byte VAR_INPUT I_Word:WORD; END_VAR VAR_OUTPUT OW_Byte:ARRAY[0..1] OF BYTE; END_VAR OW_Byte := ANYTYPE_TO_LITTLEBYTEARRAY( anyData := I_Word
// ,offset := 0 ); END_FUNCTION_BLOCK //*********************FB_IntTo_Byte********************** FUNCTION_BLOCK FB_IntTo_Byte VAR_INPUT I_Int:INT; END_VAR VAR_OUTPUT ON_Byte:ARRAY[0..1] OF BYTE; END_VAR ON_Byte := ANYTYPE_TO_LITTLEBYTEARRAY( anyData := I_Int
// ,offset := 0 ); END_FUNCTION_BLOCK //*********************FB_DWordTo_Byte********************** FUNCTION_BLOCK FB_DWordTo_Byte VAR_INPUT I_DWord:DWORD; END_VAR VAR_OUTPUT OD_Byte:ARRAY[0..3] OF BYTE; END_VAR OD_Byte := ANYTYPE_TO_LITTLEBYTEARRAY( anyData := I_DWord
// ,offset := 0 ); END_FUNCTION_BLOCK //*********************FB_LRealTo_Byte********************** FUNCTION_BLOCK FB_LRealTo_Byte VAR_INPUT I_LReal:LREAL; END_VAR VAR_OUTPUT OL_Byte:ARRAY[0..7] OF BYTE; END_VAR OL_Byte := ANYTYPE_TO_LITTLEBYTEARRAY( anyData := I_LReal
// ,offset := 0 );
Bool_To_ByteByte_To_BoolByte_To_DWord
Byte_To_INTByte_To_LRealByte_To_Word
DWrod_To_ByteINT_To_ByteLReal_To_Byte