The FRD instruction is a ladder logic rung output instruction that takes a binary coded decimal value from the Source and places the decimal equivalent in the Destination.
The instruction is enabled when the preceding logic is true and disabled otherwise. The values can be constants, tags or any combination.
In BCD each byte represents a decimal numeral which is different than displaying decimal numbers in plain binary.
- Decimal BCD
- 0 0000
- 1 0001
- 2 0010
- 3 0011
- 4 0100
- 5 0101
- 6 0110
- 7 0111
- 8 1000
- 9 1001
Before conversion:
The decimal number 99 displayed in BCD 1001_1001 (99)
After conversion:
The decimal number 99 displayed in Binary 0110_0011 (99)
The FRD instruction would convert the BCD 99 shown above into a decimal 99. Follow this link for a more detailed explanation of the Binary-Coded Decimal.
List of possible arguments
SOURCE and DESTINATION can be any combination of the following data types.
- CONSTANT Can’t be the DESTINATION obviously
- SINT
- INT
- DINT
Note: Arithmetic status flags are affected (S:V, S:Z, S:N, S:C). Overflow, Zero, Negative, and Carry.