Block that performs the conversion of a WORD value into a BCD code.
Ladder Representation
![]()
Block Structure
Variable Type |
Name |
Data Type |
Description |
VAR_INPUT |
EN |
BOOL |
Block enabling |
Value |
WORD UINT INT |
Value in WORD |
|
VAR_OUTPUT |
ENO |
BOOL |
End of operation |
Result |
WORD UINT INT |
Value in BCD |
Operation
When this block has a TRUE value in EN, it interprets the Value value as WORD and converts it into BCD, 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

Example in Ladder


The examples above perform the conversion of VALUE variable, in WORD, into a BCD 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 VALUE : WORD := 12674; RESULT : WORD; END_VAR
RESULT := FB_WORD_TO_BCD(EN:=DI1, Value:=VALUE, ENO=>DO1);
|
|---|