IDEC MICROSmart FC6A Series Ladder Programming Manual page 541

Automation organizer windldr
Hide thumbs Also See for MICROSmart FC6A Series:
Table of Contents

Advertisement

Example 7.32 Search a string
Script
[D0000] = STRSTR([D0100], [D0200]);
Operation Description
Searches for the search string "DEFG" that starts from D0200 in the string to be searched "ABCDEFGHIJKLMNO" that starts from
D0100 and stores the position of the occurrence of the string in D0000. If not found, -1 is stored in D0000.
If "?" is specified as a character to search for, it is handled as any single-byte character.
When specifying "?" (0x3F) as a character, specify it as "~?" (0x7E3F) in two bytes.
When specifying "~" (0x7E) as a character, specify it as "~~" (0x7E7E) in two bytes.
Note: The maximum length of the search string is 128 characters.
When searching for "DEFG" and the string was found
Search string
Device
Stored Value
'D' = 0x44
Upper Byte
D0200
'E' = 0x45
Lower Byte
'F' = 0x46
Upper Byte
D0201
'G' = 0x47
Lower Byte
0x00
Upper Byte
D0202
0x00
Lower Byte
When searching for "WXYZ" and the string was not found
Search string
Device
Stored Value
'W' = 0x57
Upper Byte
D0200
'X' = 0x58
Lower Byte
'Y' = 0x59
Upper Byte
D0201
'Z' = 0x5A
Lower Byte
0x00
Upper Byte
D0202
0x00
Lower Byte
String to be searched
Device
D0100
D0101
Terminating character
D0102
D0103
D0104
D0105
D0106
D0107
String to be searched
Device
D0100
D0101
Terminating character
D0102
D0103
D0104
D0105
D0106
D0107
FC6A S
MICROS
L
ERIES
MART
Stored Value
Position
'A' = 0x41
Upper Byte
'B' = 0x42
Lower Byte
'C' = 0x43
Upper Byte
'D' = 0x44
Lower Byte
'E' = 0x45
Upper Byte
'F' = 0x46
Lower Byte
'G' = 0x47
Upper Byte
'H' = 0x48
Lower Byte
'I' = 0x49
Upper Byte
'J' = 0x4A
Lower Byte
'K' = 0x47
Upper Byte
'L' = 0x4C
Lower Byte
'M' = 0x4D
Upper Byte
'N' = 0x4E
Lower Byte
'O' = 0x4F
Upper Byte
0x00
Lower Byte
Terminating character
Stored Value
Position
'A' = 0x41
Upper Byte
'B' = 0x42
Lower Byte
'C' = 0x43
Upper Byte
'D' = 0x44
Lower Byte
'E' = 0x45
Upper Byte
'F' = 0x46
Lower Byte
'G' = 0x47
Upper Byte
'H' = 0x48
Lower Byte
'I' = 0x49
Upper Byte
'J' = 0x4A
Lower Byte
'K' = 0x47
Upper Byte
'L' = 0x4C
Lower Byte
'M' = 0x4D
Upper Byte
'N' = 0x4E
Lower Byte
'O' = 0x4F
Upper Byte
0x00
Lower Byte
Terminating character
P
M
ADDER
ROGRAMMING
ANUAL
Search result
Device
Stored Value
0
D0000
1
2
← 3
4
5
6
7
8
9
10
11
12
13
14
Search result
Device
Stored Value
0
D0000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
FC9Y-B1726
26: S
CRIPT
3
-1
26-39

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents