Convert to Integer (BCD_TO)

This table lists the controllers and applications that support this instruction.
Architecture
Standard applications
Safety applications
CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers
Yes
No
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers
Yes
Yes
The BCD_TO instruction converts a BCD value (Source) to a decimal value and stores the result in the Destination.
TIP: In Logix Designer version 36, the mnemonic for this instruction changed from FRD to BCD_TO.
Available Languages
Ladder Diagram
Function Block Diagram
Function Block Diagram supports this element:
FBD Block
Structured Text
This instruction is not available in structured text.
IMPORTANT: Unexpected operation may occur if:
  • Output tag operands are overwritten.
  • Members of a structure operand are overwritten.
  • Except when specified, structure operands are shared by multiple instructions.
There are data conversion rules for mixing numeric data types within an instruction. See Data conversions.
Ladder Diagram
Operand
Data Type
CompactLogix
5370,
ControlLogix
5570,
Compact GuardLogix
5370, and
GuardLogix
5570 controllers
Data Type
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers
Format
Description
Source
SINT
INT
DINT
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
Immediate
tag
value to convert to decimal
Destination
SINT
INT
DINT
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
tag
tag to store the result
Function Block Diagram
FBD Block
Operand
Type
Format
Description
FRD tag
FBD_CONVERT
Structure
FRD structure
FBD_CONVERT Structure
Input Parameter
Data Type
Description
EnableIn
BOOL
Enable input. If cleared, the instruction does not execute and outputs are not updated.
Default is set.
Source
DINT
Input to the conversion instruction.
Valid = any integer
Output Parameters
Data Type
Description
EnableOut
BOOL
Enable output.
Dest
DINT
Result of the conversion instruction.
Description
The BCD_TO instruction converts a BCD value (Source) to a decimal value and stores the result in the Destination.
This formula is used for calculations when source is 32bits:
Destination =(16#Source8*10
7
)+ (16#Source7*10
6
)+ (16#Source6*10
5
)+( 16#Source5*10
4
)+ (16#Source4*10
3
)+(16#Source3*10
2
)+ (16#Source2*10
1
)+( 16#Source1*10
0
)
For example:
Source = 16#1234_567E
Destination = (1*10
7
)+(2*10
6
)+(3*10
5
)+ (4*10
4
)+(5*10
3
)+(6*10
2
)+(7*10
1
)+ (14*10
0
)=12345684
Affects Math Status Flags
Major/Minor Faults
Controllers
Affects Math Status Flags
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers
Conditional, see .
CompactLogix
5370,
ControlLogix
5570,
Compact GuardLogix
5370, and
GuardLogix
5570 controllers
Yes
None specific to this instruction. See Common Attributes for operand related faults.
Execution
Ladder Diagram
Condition/State
Action Taken
Prescan
N/A
Rung-condition-in is false
Set Rung-condition-out to Rung-condition-in.
Rung-condition-in is true
Set Rung-condition-out to Rung-condition-in.
Dest = decimal value of source with BCD value.
Postscan
N/A
Function Block Diagram
FBD Block
Condition/State
Action Taken
Prescan
N/A
EnableIn is false
Set EnableOut to EnableIn.
EnableIn is true
Dest = decimal value of source with BCD value If overflow occurs
Clear EnableOut to false.
else
Set EnableOut to true.
Instruction first scan
N/A
Instruction first run
N/A
Postscan
N/A
Examples
Ladder Diagram
Function Block
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.