Navigation:  Equipments (Devices) > SCA06 > Ladder > Conversion > DWORD >

BYTES_TO_DWORD

Convert Bytes to Double Word

Previous pageReturn to chapter overviewNext page

Block that performs the conversion of four 8 bits (BYTE) values into a 32 bits (DWORD) value.

 

Ladder Representation

 

BYTES_TO_DWORD_block

 

Block Structure

 

Variable Type

Name

Data type

Description

VAR_INPUT

EN

BOOL

Block enabling

Value1

BYTE USINT SINT

Value in BYTE (1st byte - LSB)

Value2

BYTE USINT SINT

Value in BYTE

Value3

BYTE USINT SINT

Value in BYTE

Value4

BYTE USINT SINT

Value in BYTE (4th byte - MSB)

VAR_OUTPUT

ENO

BOOL

End of operation

Result

DWORD UDINT DINT

Value in DWORD

 

Operation

 

When this block has a TRUE value in EN, it interprets the Value1, Value2, Value3 and Value4 values as BYTE and converts it into a DWORD variable, storing in Result.

 

When EN has FALSE value, Result remains unchanged.

 

The ENO value forwards to the next Ladder block the EN value after the operation is completed.

 

 

Block Flowchart

 

BYTES_TO_DWORD_flowchart

 

Example in Ladder

 

BYTES_TO_DWORD_example01

 

BYTES_TO_DWORD_example02

 

The examples above perform the conversion of four variables VALUE1..4, in BYTE, into a DWORD value storing the final result in RESULT. The block ends with success and ENO output is activated.

 

Example in ST

 

 The example below displays the instructions for applying the example above in the ST language.

 

 

VAR

   VALUE1 : SINT := 0;

   VALUE2 : SINT := 1;

   VALUE3 : SINT := 0;

   VALUE4 : SINT := 0;

   RESULT : DINT;

END_VAR

 

RESULT := FB_BYTES_TO_DWORD(

   EN:=DI1,

   Value1:=VALUE1,

   Value2:=VALUE2,

   Value3:=VALUE3,

   Value4:=VALUE4,

  ENO=>DO1);