ASCII Conversion Instructions
Use the ASCII conversion instructions to convert data to or from strings of ASCII characters.
Available Instructions
Ladder Diagram and Structured Text
Function Block
Not available
If you want to convert: | Use this instruction: |
---|---|
ASCII representations of integer values to SINT, INT, DINT, or REAL values (e.g., converting from a weight scale or other ASCII device to an integer so you can use it in your logic). | STOD |
ASCII representations of a floating-point value to a REAL value (e.g., converting a value from a weight scale or other ASCII device to a REAL value so you can use it in your logic). | STOR |
SINT, INT, DINT, or REAL values to a string of ASCII characters (e.g., converting a variable to an ASCII string so you can send it to a MessageView™ terminal). | DTOS |
REAL values to a string of ASCII characters (e.g., converting a variable to an ASCII string so you can send it to a MessageView terminal). | RTOS |
the letters in a string of ASCII characters to upper case (e.g., converting an entry made by an operator to all upper case so you can search for it in an array). | UPPER |
the letters in a string of ASCII characters to lower case (e.g., converting an entry made by an operator to all lower case so you can search for it in an array). | LOWER |
You can also use the following instructions to compare or manipulate ASCII characters.
If you want to: | Use this instruction: |
---|---|
Add characters to the end of a string | CONCAT |
Delete characters from a string | DELETE |
Determine the starting character of a sub-string | FIND |
Insert characters into a string | INSERT |
Extract characters from a string | MID |
Rearrange the bytes of an INT, DINT, or REAL tag | SWPB |
Compare a string to another string | CMP |
See if the characters are equal to specific characters | EQ |
See if the characters are not equal to specific characters | NE |
See if the characters are equal to or greater than specific characters | GE |
See if the characters are greater than specific characters | GT |
See if the characters are equal to or less than specific characters | LE |
See if the characters are less than specific characters | LT |
Find a string in an array of strings | FSC |
Provide Feedback