4 OPERATION CONTROL PROGRAMS
4.7 Standard Functions
159
4
BIN -> BCD conversion: BCD
■Usable data
: Usable
■Description, data type of result
• The BIN data specified with (S) is converted into BCD data.
• If (S) is a 16-bit integer type, the data range is 0 to 9999.
• If (S) is a 32-bit integer type, the data range is 0 to 99999999.
An operation error will occur if:
• The data is other than 0 to 9999 when (S) is a 16-bit integer type.
• The data is other than 0 to 99999999 when (S) is a 32-bit integer type.
• (S) is an indirectly specified device and its device No. is outside the range.
■Program which converts the BIN data of D0 into BCD data and substitutes the result to #0
Format Number of basic steps Usable steps
F/FS G
BCD(S) 4
Setting
data
Usable Data
Bit
device
Word device Constant Calculation
expression
Bit
conditional
expression
Comparison
conditional
expression
16-bit
integer
type
32-bit
integer
type (L)
64-bit
floating
point
type (F)
16-bit
integer
type
(K/H)
32-bit
integer
type
(K/H, L)
64-bit
floating
point
type (K)
(S)
Setting data Description Data type of result
(S) BIN data which will be converted into BCD data Data type of (S) (Integer type)
#0 = BCD(D0)
1#0
001010
b15 b0
011010 101
BCD 9999
0D0
010011100001111
b15 b0
BIN 9999
Thousands Hundreds Tens Units