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

DWORD_TO_WORDS

Convert Double Word to Words

Previous pageReturn to chapter overviewNext page

Block that performs the conversion of a 32 bits (DWORD) value in two 16 bits (2 WORD) value.

 

Ladder Representation

 

DWORD_TO_WORDS_block

 

Block Structure

 

Variable Type

Name

Data type

Description

VAR_INPUT

EN

BOOL

Block enabling

Value

DWORD UDINT DINT

Value in DWORD

VAR_OUTPUT

ENO

BOOL

End of operation

Result1

WORD UINT INT

Value in WORD (Less Significant Word)

Result2

WORD UINT INT

Value in WORD (More Significant Word)

 

Operation

 

When this block has a TRUE value in EN, it interprets the value as DWORD and converts it in two WORD variables (Result1 and Result2), 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

 

DWORD_TO_WORDS_flowchart

 

Example in Ladder

 

DWORD_TO_WORDS_example01

 

DWORD_TO_WORDS_example02

 

The examples above perform the conversion of a variable VALUE, in DWORD, in two WORD values storing the final result in RESULT1 and RESULT2. 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

   VALUE : DINT := 65536;

   RES1 : INT;

   RES2 : INT;

END_VAR

 

DO1 := FB_DWORD_TO_WORDS(

   EN:=DI1,

   Value:=VALUE,

   Result1=>RES1,

   Result2=>RES2);