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

BYTES_TO_WORD

Convert Bytes to Word

Previous pageReturn to chapter overviewNext page

Block that performs the conversion of two 8 bits (BYTE) values into a 16 bits (WORD) value.

 

Ladder Representation

 

BYTES_TO_WORD_block

 

Block Structure

 

Variable Type

Name

Data type

Description

VAR_INPUT

EN

BOOL

Block enabling

Value1

BYTE USINT SINT

1st BYTE (LSB)

Value2

BYTE USINT SINT

2nd BYTE (MSB)

VAR_OUTPUT

ENO

BOOL

End of operation

Result

WORD UINT INT

Value in WORD

 

Operation

 

When this block has a TRUE value in EN, it interprets the Value1 and Value2 values as BYTE and converts it into a WORD 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_WORD_flowchart

 

Example in Ladder

 

BYTES_TO_WORD_example01

 

BYTES_TO_WORD_example02

 

The examples above perform the conversion of two variable VALUE1 and VALUE2, in BYTE, into a WORD 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 := 5;

   VALUE2 : SINT := 10;

   RESULT : WORD;

END_VAR

 

RESULT := FB_BYTES_TO_WORD(

   EN:=DI1,

   Value1:=VALUE1,

   Value2:=VALUE2,

  ENO=>DO1);