396
7 APPLICATION INSTRUCTION
7.6 Character string operation instruction
Replacing the specified number of character strings
MIDW(P)
These instructions extract the number of characters specified by (s2)+1 from the character string data stored in the device
specified by (s1) and later, and store the extracted data in the position specified by (s2) and later of the character string data
stored in the device specified by (d) and later.
■Descriptions, ranges, and data types
■Applicable devices
*1 T, ST, C cannot be used.
• These instructions extract the number of characters specified by (s2)+1 from the character string data stored in the device
specified by (s1) and later, and store the extracted data in the position specified by (s2) and later of the character string
data stored in the device specified by (d) and later.
• A character string stored in (s1) or (d) indicates data stored in devices from the specified device until "00H" is first detected
in units of 1 byte.
• A NULL code (00H), which indicates an end of a character string, is automatically added at the end of the character string
data.
Ladder diagram Structured text
ENO:=MIDW(EN,s1,s2,d);
ENO:=MIDWP(EN,s1,s2,d);
Operand Description Range Data type Data type (label)
(s1) Character string or head device number storing a character string Character string Character string
(d) Head device number for storing the character string data of the
operation result
Character string Character string
(s2) Head device number for storing the number of characters and
position of the start character
(s2)+0: Position of the start character, (s2)+1: Number of characters
16-bit signed binary ANY16
Operand Bit Word Double word Indirect
specification
Constant Others
X, Y, M, L,
SM, F, B, SB
U\G T, ST,
C, LC
T, ST, C, D,
W, SD, SW, R
U\G Z LC LZ K, H E $
(s1)
*1
(d)
*1
(s2)
30H (0)31H (1)
32H (2)33H (3)
34H (4)35H (5)
36H (6)37H (7)
38H (8)00H
b15 b0
b7b8
(s1)
(s1)+1
(s1)+2
(s1)+3
(s1)+4
(s2)
(s2)+1
"012345678"
"ABCDEFGHI"
"AB012345I"
3
6
41H (A)42H (B)
43H (C)44H (D)
45H (E)46H (F)
47H (G)48H (H)
49H (I)00H
b15 b0
b7b8
(d)
(d)+1
(d)+2
(d)+3
(d)+4
41H (A)42H (B)
30H (0)31H (1)
32H (2)33H (3)
34H (4)35H (5)
49H (I)00H
b15 b0
b7b8
(d)
(d)+1
(d)+2
(d)+3
(d)+4
Before execution
After execution
Position from the left end in the character string
stored in (d) and later
Number of characters from the left end in the
character string stored in (s1) and later