Publication 1766-RM001A-EN-P - October 2008
ASCII Instructions
387
Example
Error Conditions
The following conditions cause the controller to set the ASCII Error bit
(S:5/15).
•
Source string length is less than 1 or greater than 82.
•
Index value is less than 1 or greater than 82.
•
Index value is greater than Source string length.
The destination is not changed in any of the above conditions. When the
ASCII String Manipulation Error bit (S:5/15) is set, the Invalid String
Length Error (1F39H) is written to the Major Error Fault Code word (S:6).
ASR - ASCII String
Compare
Instruction Type: input
Use the ASR instruction to compare two ASCII strings. The controller
looks for a match in length and upper/lower case characters. If two
strings are identical, the rung is true; if there are any differences, the rung
is false.
Entering Parameters
Enter the following parameters when programming this instruction:
•
Source A
is the location of the first string used for comparison.
•
Source B
is the location of the second string used for comparison.
I:1
10
ASC
String Search
Source
ST38:40
Index
35
String Search
ST52:80
Result
N10:0
ASC
If input slot 1, bit 10 is set, search the string
in ST52:80 starting at the 36th character, for
the string found in ST38:40. In this example,
the position result is stored in N10:0.
ASR
ASCII String Compare
Source A
ST10:8
Source B
ST10:9
ASR
Execution Time for the ASR Instruction
Controller
When Instruction Is:
True
False
MicroLogix 1400
4.8596 µs
0.2016 µs
efesotomasyon.com - Allen Bradley,Rockwell,plc,servo,drive