String in Advanced Ladder
See also: Project Toolbox for Advanced Ladder
String Operations Topics include:
A string is a succession of characters. Cscape strings are delimited (prefixed and suffixed) by the Single Quote character ('). Cscape strings can be zero characters in length.
The following are some valid Cscape strings.
'Hot' - Length = 3
'Cold' - Length = 4
'' - Length = 0
' ' - A single SPACE character. Length = 1
Any 8-bit binary value is acceptable in a string no just ASCII ASCII - American Standard Code for Information Interchange - ASCII-coded characters are single-byte values in the range of 0 (zero) to 127. Codes in the range 128 to 255 are not defined by the ASCII standard, but rather by the equipment manufacturer. characters. However, the usefulness of non-ASCII characters is limited by the display capabilities of the unit for which they are intended. Since Cscape strings are delimited by the Single Quote character, the Null Character (binary value 00) is an acceptable character.
Special Characters
Because the Single Quote ( ' ) is used to delimit strings, the Single Quote cannot be inserted directly into a Cscape String. In order to insert a Single Quote, a two-character combination is used. The marker character is the Dollar Sign '$'. Using this method, several other useful Special Character combinations are available.
Combination |
Printed Interpretation |
$$ |
Dollar Sign |
$' |
Single Quote |
$L or $l |
Line Feed |
$N or $n |
New Line |
$P or $p |
Form Feed (page feed) |
$R or $r |
Carriage Return |
$T or $t |
Tab |
The New Line character ($N) provides an implementation-independent means of defining the end of data for both physical and file I/O. When printed, the effect is that of ending the current line of text and resuming printing at the beginning of the next line.
Hexadecimal
A base-16 numbering system which uses the symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F for numeral. Numbers
Hexadecimal numbers are also accepted. Hexadecimal number can be entered by using the Dollar Sign followed by two hexadecimal characters:
Combination |
Printed Interpretation |
$0D |
Carriage return (same as $R) |
$0D$0A |
CR/LF sequence (same as $R$L) |
$00 |
Null characters |
$FF |
Binary value 255 |
A hexadecimal number must contain exactly two (2) characters. Possible characters are '0' - '9', 'A' - 'F', and 'a' - 'f'. The conversion is not case sensitive. Hexadecimal number must be exactly two characters. If the number can be represented with one hexadecimal character (i.e., '$a'), the string must contain a leading 0 (i.e.: '$0a').
Return to the Top:String in Advanced Ladder