
398
7 APPLICATION INSTRUCTION
7.6 Character string operation instruction
Searching character string
INSTR(P)
These instructions search the character string data stored in the device specified by (s2) and later starting from the (s3)th
character from the left, for the character string data stored in the device specified by (s1) and later and store the search result
in the device specified by (d).
Setting data
■
Descriptions, ranges, and data types
■
Applicable devices
*1
T, ST, C cannot be used.
Processing details
• These instructions search the character string data stored in the device specified by (s2) and later starting from the (s3)th
character from the left, for the character string data stored in the device specified by (s1) and later and store the search
result in the device specified by (d). The search result stores the position where the first detected character is located from
the start character in the character string data stored in (s2).
• If no matched character string data is found, 0 is stored in (d).
• When the search start position "s3" is a negative number or "0", search processing is not executed.
Ladder diagram
Structured text
ENO:=INSTR(EN,s1,s2,s3,d);
ENO:=INSTRP(EN,s1,s2,s3,d);
Operand
Description
Range
Data type
Data type (label)
(s1)
Character string to be searched for or head device number
storing a character string to be searched for
Character string
Character string
(s2)
Character string to be searched or head device number storing a
character string to be searched
Character string
Character string
(d)
Head device number storing search result
16-bit signed binary
ANY16
(s3)
Search start position
1 to 16383
16-bit unsigned 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)
(s2)
(d)
(s3)
(s1)
(s2)
(d)
(s3)
41H (A)
42H (B)
43H (C)
44H (D)
45H (E)
46H (F)
47H (G)
48H (H)
45H (E)
46H (F)
47H (G)
48H (H)
49H (I)
4AH (J)
4BH (K)
00H
00H
"ABCDEFGHIJK"
"EFGH"
b15
b0
b7
b8
b15
b0
b7
b8
(s2)
(s2)+1
(s2)+2
(s2)+3
(s2)+4
(s2)+5
(s1)
(s1)+1
(s1)+2
3
(s3)
5
(d)
Search start position (s3):
3rd character
Fifth character from the
head character
Summary of Contents for MELSEC iQ-F FX5 series
Page 1: ...MELSEC iQ F FX5 Series Programming Manual Instructions Standard Functions Function Blocks ...
Page 2: ......
Page 21: ...19 PART 1 PART 1 OVERVIEW Part 1 consists of the following chapter 1 OVERVIEW ...
Page 98: ...96 4 STANDARD FUNCTIONS FUNCTION BLOCKS 4 2 Standard Function Blocks MEMO ...
Page 840: ...838 23 TIME DATA FUNCTIONS 23 4 Division MEMO ...
Page 887: ......