advertisement
Chapter 5 Compare Instructions (CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ)
Use Strings In an Expression
Use a relay ladder or structured text expression to compare string data types.
To use strings in an expression, follow these guidelines:
•
An expression lets you compare two string tags.
•
You cannot enter ASCII characters directly into the expression.
•
Only the following operators are permitted
>
>=
<>
Operator
=
<
<=
Description
equal less than less than or equal greater than greater than or equal not equal
•
Strings are equal if their characters match.
•
ASCII characters are case sensitive. Upper case “A” ($41) is not equal to lower case “a” ($61).
•
The hexadecimal values of the characters determine if one string is less than or greater than another string. For the hex code of a character, see the back cover of this manual.
•
When the two strings are sorted as in a telephone directory, the order of the strings determines which one is greater. s e r e s l e r a t g r e
AB
B a ab
ASCII Characters Hex Codes
1ab
1b
A
$31$61$62
$31$62
$41
$41$42
$42
$61
$61$62
AB < B a > B
210
Publication 1756-RM003K-EN-P - July 2008
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
advertisement
Related manuals
advertisement
Table of contents
- 24 Introduction
- 24 Who Should Use This Manual
- 25 Purpose of This Manual
- 26 Common Information for All Instructions
- 26 Conventions and Related Terms
- 26 Set and clear
- 27 Relay ladder rung condition
- 28 Function block states
- 30 Introduction
- 31 Digital Alarm (ALMD)
- 37 State Diagrams when Acknowledgement Required
- 38 State Diagrams when Acknowledgment Not Required
- 39 ALMD Alarm Acknowledge Required and Latched
- 40 ALMD Alarm Acknowledge Required and Not Latched
- 40 ALMD Alarm Acknowledge Not Required and Latched
- 41 ALMD Alarm Acknowledge Not Required and Not Latched
- 43 Analog Alarm (ALMA)
- 55 State Diagrams when Acknowledgement Required
- 56 State Diagrams when Acknowledgement Not Required
- 59 ALMA Level Condition Acknowledge Required
- 60 ALMA Level Condition Acknowledge Not Required
- 61 ALMA Rate of Change Acknowledge Required
- 62 ALMA Rate of Change Acknowledge Not Required
- 64 Configure an Alarm Instruction
- 66 Enter Alarm Message Text
- 68 Message String Variables
- 69 Multiple Language Versions of Alarm Messages
- 70 Monitor Alarm Status
- 70 Buffering Alarms
- 71 Programmatically Access Alarm Information
- 72 Suppress or Disable Alarms
- 73 Controller-based Alarm Execution
- 74 Controller Memory Use
- 76 Scan Time
- 78 Introduction
- 79 Examine If Closed (XIC)
- 81 Examine If Open (XIO)
- 83 Output Energize (OTE)
- 85 Output Latch (OTL)
- 87 Output Unlatch (OTU)
- 89 One Shot (ONS)
- 92 One Shot Rising (OSR)
- 95 One Shot Falling (OSF)
- 97 One Shot Rising with Input (OSRI)
- 100 One Shot Falling with Input (OSFI)
- 104 Introduction
- 105 Timer On Delay (TON)
- 109 Timer Off Delay (TOF)
- 113 Retentive Timer On (RTO)
- 117 Timer On Delay with Reset (TONR)
- 121 Timer Off Delay with Reset (TOFR)
- 125 Retentive Timer On with Reset (RTOR)
- 129 Count Up (CTU)
- 133 Count Down (CTD)
- 137 Count Up/Down (CTUD)
- 142 Reset (RES)
- 144 Introduction
- 145 Message (MSG)
- 153 MSG Error Codes
- 153 Error Codes
- 155 Extended Error Codes
- 157 PLC and SLC Error Codes (.ERR)
- 159 Block-Transfer Error Codes
- 160 Specify the Configuration Details
- 161 Specify CIP Data Table Read and Write messages
- 162 Reconfigure an I/O module
- 163 Specify CIP Generic messages
- 164 Specify PLC-5 messages
- 166 Specify SLC messages
- 166 Specify block-transfer messages
- 167 Specify PLC-3 messages
- 168 Specify PLC-2 messages
- 169 MSG Configuration Examples
- 170 Specify the Communication Details
- 170 Specify a path
- 173 For Block Transfers
- 173 Specify a Communication Method Or Module Address
- 174 Choose a cache option
- 176 Guidelines
- 177 Get System Value (GSV) and Set System Value (SSV)
- 180 GSV/SSV Objects
- 181 Access the CONTROLLER object
- 182 Access the CONTROLLERDEVICE object
- 184 Access the CST object
- 185 Access the DF1 object
- 188 Access the FAULTLOG object
- 189 Access The MESSAGE Object
- 191 Access The MODULE Object
- 192 Access The MOTIONGROUP Object
- 193 Access The PROGRAM Object
- 194 Access The Routine object
- 194 Access The SERIALPORT Object
- 196 Access The TASK Object
- 198 Access The WALLCLOCKTIME Object
- 199 GSV/SSV Programming Example
- 199 Get Fault Information
- 201 Set Enable And Disable Flags
- 202 Immediate Output (IOT)
- 206 Introduction
- 207 Compare (CMP)
- 209 CMP expressions
- 209 Valid operators
- 210 Format Expressions
- 210 Determine The Order of Operation
- 211 Use Strings In an Expression
- 212 Equal to (EQU)
- 216 Greater than or Equal to (GEQ)
- 220 Greater Than (GRT)
- 224 Less Than or Equal to (LEQ)
- 228 Less Than (LES)
- 232 Limit (LIM)
- 238 Mask Equal to (MEQ)
- 239 Entering an Immediate Mask Value
- 243 Not Equal to (NEQ)
- 248 Introduction
- 249 Compute (CPT)
- 251 Valid operators
- 251 Format Expressions
- 252 Determine the order of operation
- 253 Add (ADD)
- 256 Subtract (SUB)
- 259 Multiply (MUL)
- 262 Divide (DIV)
- 267 Modulo (MOD)
- 271 Square Root (SQR)
- 275 Negate (NEG)
- 278 Absolute Value (ABS)
- 282 Introduction
- 284 Move (MOV)
- 286 Masked Move (MVM)
- 287 Enter an immediate mask value
- 289 Masked Move with Target (MVMT)
- 292 Bit Field Distribute (BTD)
- 295 Bit Field Distribute with Target (BTDT)
- 298 Clear (CLR)
- 300 Swap Byte (SWPB)
- 304 Bitwise AND (AND)
- 307 Bitwise OR (OR)
- 311 Bitwise Exclusive OR (XOR)
- 315 Bitwise NOT (NOT)
- 318 Boolean AND (BAND)
- 321 Boolean OR (BOR)
- 324 Boolean Exclusive OR (BXOR)
- 327 Boolean NOT (BNOT)
- 330 Introduction
- 331 Selecting Mode of Operation
- 331 All mode
- 332 Numerical mode
- 334 Incremental mode
- 336 File Arithmetic and Logic (FAL)
- 345 FAL Expressions
- 345 Valid operators
- 346 Format Expressions
- 346 Determine the order of operation
- 347 File Search and Compare (FSC)
- 352 FSC expressions
- 353 Valid Operators
- 353 Format Expressions
- 354 Determine the order of operation
- 355 Use Strings In an Expression
- 356 Copy File (COP) Synchronous Copy File (CPS)
- 362 File Fill (FLL)
- 366 File Average (AVE)
- 371 File Sort (SRT)
- 376 File Standard Deviation (STD)
- 382 Size In Elements (SIZE)
- 386 Introduction
- 387 Bit Shift Left (BSL)
- 391 Bit Shift Right (BSR)
- 395 FIFO Load (FFL)
- 401 FIFO Unload (FFU)
- 407 LIFO Load (LFL)
- 413 LIFO Unload (LFU)
- 420 Introduction
- 421 Sequencer Input (SQI)
- 422 Enter an Immediate Mask Value
- 424 Use SQI without SQO
- 425 Sequencer Output (SQO)
- 426 Enter an Immediate Mask Value
- 428 Using SQI with SQO
- 428 Resetting the position of SQO
- 429 Sequencer Load (SQL)
- 434 Introduction
- 435 Label (LBL)
- 437 Subroutine (SBR) Return (RET)
- 448 Jump to External Routine (JXR)
- 451 Temporary End (TND)
- 453 Master Control Reset (MCR)
- 455 User Interrupt Disable (UID) User Interrupt Enable (UIE)
- 457 Always False Instruction (AFI)
- 458 No Operation (NOP)
- 459 End of Transition (EOT)
- 461 SFC Pause (SFP)
- 463 SFC Reset (SFR)
- 465 Trigger Event Task (EVENT)
- 465 a Task
- 470 Introduction
- 471 For (FOR)
- 474 Break (BRK)
- 475 Return (RET)
- 478 Introduction
- 479 File Bit Comparison (FBC)
- 481 Selecting the Search Mode
- 487 Diagnostic Detect (DDT)
- 489 Selecting the search mode
- 495 Data Transitional (DTR)
- 496 Enter an immediate mask value
- 498 Proportional Integral Derivative (PID)
- 503 Configure a PID Instruction
- 504 Specify Tuning
- 505 Specify Configuration
- 505 Specifying Alarms
- 506 Specifying Scaling
- 506 Using PID Instructions
- 509 PID instruction timing
- 513 Bumpless Restart
- 514 Derivative Smoothing
- 515 Set the Deadband
- 515 Use Output Limiting
- 516 Feedforward or Output Biasing
- 516 Cascading Loops
- 517 Control a Ratio
- 518 PID Theory
- 518 PID Process
- 518 PID Process With Master/slave Loops
- 520 Introduction
- 521 Sine (SIN)
- 524 Cosine (COS)
- 527 Tangent (TAN)
- 530 Arc Sine (ASN)
- 533 Arc Cosine (ACS)
- 536 Arc Tangent (ATN)
- 540 Introduction
- 541 Natural Log (LN)
- 544 Log Base 10 (LOG)
- 547 X to the Power of Y (XPY)
- 550 Introduction
- 551 Degrees (DEG)
- 554 Radians (RAD)
- 557 Convert to BCD (TOD)
- 560 Convert to Integer (FRD)
- 562 Truncate (TRN)
- 566 Introduction
- 567 Instruction Execution
- 569 ASCII Error Codes
- 569 String Data Types
- 571 ASCII Test For Buffer Line (ABL)
- 574 ASCII Chars in Buffer (ACB)
- 576 ASCII Clear Buffer (ACL)
- 578 ASCII Handshake Lines (AHL)
- 582 ASCII Read (ARD)
- 586 ASCII Read Line (ARL)
- 590 ASCII Write Append (AWA)
- 595 ASCII Write (AWT)
- 600 Introduction
- 601 String Data Types
- 602 String Concatenate (CONCAT)
- 604 String Delete (DELETE)
- 606 Find String (FIND)
- 608 Insert String (INSERT)
- 610 Middle String (MID)
- 612 Introduction
- 614 String Data Types
- 615 String To DINT (STOD)
- 617 String To REAL (STOR)
- 620 DINT to String (DTOS)
- 622 REAL to String (RTOS)
- 624 Upper Case (UPPER)
- 626 Lower Case (LOWER)
- 628 Introduction
- 628 Breakpoints (BPT)
- 629 String Format
- 632 Tracepoints (TPT)
- 632 String Format
- 636 Introduction
- 636 Immediate Values
- 636 Data Conversions
- 638 SINT or INT to DINT
- 640 Integer to REAL
- 640 DINT to SINT or INT
- 641 REAL to an Integer
- 642 Introduction
- 642 Choose the Function Block Elements
- 643 Latching Data
- 645 Order of Execution
- 646 Resolve a Loop
- 648 Resolve Data Flow Between Two Blocks
- 648 Create a One Scan Delay
- 649 Summary
- 649 Function Block Responses to Overflow Conditions
- 650 Timing Modes
- 652 Common Instruction Parameters for Timing Modes
- 654 Overview of Timing Modes
- 655 Program/Operator Control
- 660 Introduction
- 660 Structured Text Syntax
- 662 Assignments
- 663 Specify a non-retentive assignment
- 664 Assign an ASCII character to a string
- 664 Expressions
- 666 Use arithmetic operators and functions
- 667 Use relational operators
- 669 Use logical operators
- 670 Use bitwise operators
- 670 Determine the order of execution
- 671 Instructions
- 672 Constructs
- 672 Some key words are reserved for future use
- 673 IF...THEN
- 676 CASE...OF
- 679 FOR…DO
- 682 WHILE…DO
- 685 REPEAT…UNTIL
- 688 Comments
- 700 ASCII Character Codes