5 OPERATION CONTROL PROGRAMS
5.6.15 BIN
BCD conversion : BCD
Format
[Usable data]
Setting
16-bit
data
Bit device
integer
type
(S)
—
[Setting data]
Setting data
[Functions]
[Errors]
[Program examples]
BCD(S)
Word device
64-bit
32-bit
floating
integer
point
type (L)
type (F)
—
(S)
BIN data which will be converted into BCD data
(1) The BIN data specified with (S) is converted into BCD data.
(2) If (S) is a 16-bit integer type, the data range is 0 to 9999.
(3) If (S) is a 32-bit integer type, the data range is 0 to 99999999.
(1) 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; or
• (S) is an indirectly specified device and its device No. is outside the range.
(1)
Program which converts the BIN data of D0 into BCD data and substitutes the
result to #0
#0 = BCD(D0)
BCD 9999
b15
#0
1 0 0 1 1 0 0 1 1 0 0 1 1 0 0
Thousands Hundreds Tens
Usable Data
Constant
16-bit
32-bit
Coasting
integer
integer type
timer
type (K/H)
(K/H, L)
Description
b0
D0
1
Units
5 - 41
F/FS
Number of basic steps
64-bit
Calculation
conditional
floating
expression
expression
point
type (K)
—
Data type of result
Data type of (S)
(Integer type)
BIN 9999
b15
b0
0 0 1 0 0 1 1 1 0 0 0 0 1 1 1 1
G
2
Bit
Comparison
conditional
expression
—
—
: Usable