Mitsubishi Electronics Q173CPU(N) Home Security System User Manual


 
7 - 39
7 OPERATION CONTROL PROGRAMS
F/FS G
7.6.15 BIN BCD conversion : BCD
Format BCD(S) Number of basic steps 2
[Usable data]
Usable Data
Word device Constant
Setting
data
Bit device
16-bit
integer
type
32-bit
integer
type (L)
64-bit
floating
point
type (F)
Coasting
timer
16-bit
integer
type (K/H)
32-bit
integer type
(K/H, L)
64-bit
floating
point
type (K)
Calculation
expression
Bit
conditional
expression
Comparison
conditional
expression
(S) —
— —
: Usable
[Setting data]
Setting data Description Data type of result
(S) BIN data which will be converted into BCD data
Data type of (S)
(Integer type)
[Functions]
(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.
[Errors]
(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.
[Program examples]
(1) Program which converts the BIN data of D0 into BCD data and substitutes the
result to #0
#0 = BCD(D0)
D0
0 0 1 0 0 1 1 1 0 0 0 0 1 1 1 1
b0 b15
BIN 9999
#0
1 0 0 1 1 0 0 1 1 0 0 1 1 0 0
b0b15
BCD 9999
Thousands Hundreds Tens Units
1