Separating data in byte units
WTOB(P)
These instructions separate the 16-bit binary data in the device numbers starting from the one specified by (s) onwards into
(n) byte units, and store the separated data in the device number specified by (d) onwards.
Ladder diagram
(s)
Setting data
■Descriptions, ranges, and data types
Operand
Description
(s)
Head device where the separation target data is stored
(d)
Head device for storing the result of separation in byte unit
(n)
Number of byte units
■Applicable devices
Operand
Bit
X, Y, M, L,
SM, F, B, SB
(s)
(d)
(n)
Processing details
• These instructions separate the 16-bit binary data in the device numbers starting from the one specified by (s) onwards into
(n) byte units, and store the separated data in the device number specified by (d) onwards.
b15
(s)
Upper byte
(s)+1
Upper byte
n
*1
(s)+(
-1)
Upper byte
2
*1 Values after the decimal point are rounded up.
6 BASIC INSTRUCTIONS
292
6.5 Data Conversion Instructions
(d)
(n)
Word
U\G T, ST,
T, ST, C, D,
C, LC
W, SD, SW, R
···
b8
b7
···
Lower byte
Lower byte
Lower byte
Structured text
ENO:=WTOB(EN,s,n,d);
ENO:=WTOBP(EN,s,n,d);
Range
0 to 65535
Double word Indirect
U\G
Z
LC
b0
b15
(d)
(d)+1
(d)+2
(d)+3
(d)+(n-2)
(d)+(n-1)
Data type
16-bit signed binary
16-bit signed binary
16-bit unsigned binary
Constant
specification
LZ
K, H
···
b8
b7
···
00H
Lower byte data
00H
Upper byte data
00H
Lower byte data
00H
Upper byte data
00H
Lower byte data
00H
Upper byte data
Data type (label)
ANY16
ANY16
ANY16
Others
E
$
b0
(n)