Rockwell-automation 1746-BAS BASIC LANGUAGE User Manual Page 36

  • Download
  • Add to my manuals
  • Print
  • Page
    / 280
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 35
Publication 1746-RM001A-US-P
3-14 Expressions and Operators
CHR([expr])
Use the CHR operator to convert a numeric expression to an ASCII character.
Like the ASC operator, the CHR operator also selects individual characters in a
defined ASCII string.
>NEW
>1 REM EXAMPLE PROGRAM
>5 STRING 1000,40
>10 $(1) = β€œThe module”
>20 FOR I = 1 TO 16 : PRINT CHR($(1),I),: NEXT I
READY
>RUN
The module
READY
>
In the example above, the expressions contained within the parentheses, following
the CHR operator have the same meaning as the expressions in the ASC operator.
Unlike the ASC operator, you cannot assign the CHR operator a value. A statement
such as CHR ($(1),1)= H is INVALID and generates an
ERROR: BAD SYNTAX
message, causing the module to go into Command mode. Use the ASC operator to
change a value in a string, or use the string support CALL routine – replace string
in a string.
Example Result
>PRINT CHR(65) A
IMPORTANT
Use the CHR function only in a print statement. You cannot use
the CHR operator in a DATA statement.
Page view 35
1 2 ... 31 32 33 34 35 36 37 38 39 40 41 ... 279 280

Comments to this Manuals

No comments