Upper Case (UPPER)

This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers.
The UPPER instruction converts the alphabetical characters in a string to upper case characters.
Available Languages
Ladder Diagram
UPPER_LD_avail_v31
Function Block
This instruction is not available in function block.
Structured Text
UPPER(Source,Dest);
Operands
Ladder Diagram and Structured Text
Operand
Type
Format
Description
Source
String
tag
Tag that contains the characters you want to convert to upper case
Destination
String
tag
Tag to store the characters in upper case
See
Structured Text
for more information on the syntax of expressions within structured text.
Description
The UPPER instruction converts all the letters in the Source to upper case, and places the result in the Destination.
  • ASCII characters are case-sensitive. Upper case A ($41) is not equal to lower case a ($61).
  • If operators directly enter ASCII characters, convert the characters to all upper case or lower case before you compare them.
Any characters in the Source string that are not letters remain unchanged.
Affects Math Status Flags
No
Major/Minor Faults
Type
Code
Cause
Recovery Method
4
51
The LEN value of the string tag is greater than the DATA size of the string tag.
Check that no instruction is writing to the LEN member of the string type tag.
In the LEN value, enter the number of characters that the string contains.
4
52
The output string is larger than the destination
Create a new string type that is large enough for the output string. Use the new string type as the data type for the destination.
Execution
Ladder Diagram
Condition/State
Action Taken
Prescan
N/A
Rung-condition-in is false
N/A
Rung-condition-in is true
The instruction executes.
Postscan
N/A
Structured Text
Condition
Action
Prescan
See Prescan in the preceding Ladder Diagram table
Normal execution
See rung-condition-in is true in the preceding Ladder Diagram table.
Postscan
See Postscan in the preceding Ladder Diagram table
Example
To find information about a specific item, an operator enters the catalog number of the item into an ASCII terminal. After the controller reads the input from a terminal (terminal_read is set), the UPPER instruction converts the characters in catalog_number to all upper case characters and stores the result in catalog_number_upper_case. A subsequent rung then searches an array for characters that match those in catalog_number_upper_case.
Ladder Diagram
UPPER_LD_ex_v31
Structured Text
IF terminal_read THEN
UPPER(catalog_number,catalog_number_upper_case);
terminal_read := 0;
END_IF;
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.