05.05.2014 Views

csmstr - Omega Engineering

csmstr - Omega Engineering

csmstr - Omega Engineering

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

WRITING EXPRESSIONS<br />

DATA VALUES<br />

CHARACTER CONSTANTS<br />

Character constants represent a single ASCII character, encoded in the lower 8 bits of a 32-bit<br />

signed number. A character constant comprises a single character enclosed in single quotation<br />

marks, such that 'A' can be used to represent a value of 65. Certain otherwise unprintable or<br />

unrepresentable characters can be encoded using what are called escape sequences, each of<br />

which is introduced with a single backslash…<br />

SEQUENCE VALUE ASCII<br />

\a Hex 0x07, Decimal 7 BEL<br />

\t Hex 0x09, Decimal 9 TAB<br />

\n Hex 0x0A, Decimal 10 LF<br />

\f Hex 0x0C, Decimal 12 FF<br />

\r Hex 0x0D, Decimal 13 CR<br />

\e Hex 0x1B, Decimal 27 ESC<br />

\xnn The hex value represented by nn. -<br />

\nnn The octal value represented by nnn. -<br />

\\ A single backslash character. -<br />

\' A single quotation mark character. -<br />

\" A double quotation mark character. -<br />

LOGICAL CONSTANTS<br />

Logical constants represent a 1 or 0 value that is used to indicate the truth or otherwise of a<br />

yes-or-no expression. An example of something that can be assigned to be equal to a logical<br />

constant is a tag that represents a digital output in a PLC. Logical constants can either be<br />

entered simply as 1 or 0, or by use of the keywords true or false.<br />

FLOATING-POINT CONSTANTS<br />

Floating-point constants represent a 32-bit single-precision floating-point value. They are<br />

represented as you might expect—by the integer portion, followed by a single decimal point,<br />

followed by the fractional portion. Exponential notation is not supported.<br />

STRING CONSTANTS<br />

String constants represent sequences of characters. They comprise the characters to be<br />

represented, enclosed in double quotation marks. For example, the string "ABCD" represents a<br />

four-character string, comprising the values 65, 66, 67 and 68. (Actually, five bytes are used<br />

to store the string, with a null value being appended to indicate the end of the string.) The<br />

various escape sequences discussed above may also be used within strings.<br />

TAG VALUES<br />

The value of a tag is represented in an expression by the tag name. Upper-case and lower-case<br />

characters are considered equivalent when finding the required tag. Also, once an expression<br />

REVISION 6 PAGE 261

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!