Character String Search - Mitsubishi Electric MELSEC-Q/L Programming Manual

Hide thumbs Also See for MELSEC-Q/L:
Table of Contents

Advertisement

Character string search

INSTR(P)
Basic
High
Process
performance
INSTR
INSTRP
(S1): Character string to be searched or head number of the devices where the character string to be searched is stored (character string)
(S2): Character string in which a search is performed or head number of the devices where the character string is stored (character string)
(D): Head number of the devices where the result of search will be stored (BIN 16 bits)
n:
Location to start the search (BIN 16 bits)
Setting
Internal device
data
Bit
(S1)
(S2)
(D)
n
Processing details
• Searches for the character string data designated by (S1) in the area starting from the nth character from the left of the
character string data designated by (S2) and stores the result of search at the device designated by (D). As the result of
search, the location of match, counted in the number of characters from the first character of the character string data
designated by (S2), is stored.
When n=3
b15
S2
42
(B)
H
+1
S2
44
(D)
H
+2
S2
46
(F)
H
+3
S2
48
(H)
H
+4
S2
4A
(J)
H
+5
S2
00
H
"ABCDEFGHIJK"
• If there is no matching character string data, stores "0" at (D).
Operation error
• In any of the following cases, an operation error occurs, the error flag (SM0) turns ON, and an error code is stored into SD0.
Error
Error details
code
4100
The value of n exceeds the number of characters for (S2).
The number of character specified by (S1) is 0.
There is no NULL code "00H" within the range of the corresponding devices
starting from the devices specified by (S1) and (S2).
n is negative or 0.
7 APPLICATION INSTRUCTIONS
584
7.11 Character String Processing Instructions
Redundant Universal
LCPU
Command
Command
R, ZR
J\
Word
Bit
b8b7
b0
41
(A)
Searches from the
H
3rd character
43
(C)
H
5th character from
45
(E)
H
the first character
47
(G)
H
49
(I)
H
4B
(K)
H
INSTR
S1
S2
INSTRP
S1
S2
U\G
Zn
Word
b15
S1
46
(F)
H
S1
+1
48
(H)
H
+2
S1
D
Q00J/
QnH
Q00/
Q01
n
D
n
D
Constant
K, H
$
b8b7
b0
45
(E)
H
47
(G)
H
00
H
"EFGH"
Stores the position of the
5
found character, counted
by the number of characters
from the 1st character in
the character string data
designated by
QnPH
QnPRH
QnU
Others
.
S2
LCPU

Advertisement

Table of Contents
loading

Table of Contents