This statement returns 3 characters of the string variable named STR.
Numeric data may be formatted using the {Fn.m} expression following the completed MG statement.
{$n.m} formats data in HEX instead of decimal. The actual numerical value will be formatted with n
characters to the left of the decimal and m characters to the right of the decimal. Leading zeros will be used
to display specified format.
For example:
MG "The Final Value is", RESULT {F5.2}
If the value of the variable RESULT is equal to 4.1, this statement returns the following:
The Final Value is 00004.10
If the value of the variable RESULT is equal to 999999.999, the above message statement returns the
following:
The Final Value is 99999.99
The message command normally sends a carriage return and line feed following the statement. The carriage
return and the line feed may be suppressed by sending {N} at the end of the statement. This is useful when a
text string needs to surround a numeric value.
Example:
#A
FNAME=“John”
LNAME=“Smith”
MG “The name is ”, FNAME{S3} {N}
MG “ ”,LNAME{S6}
EN
When #A is executed, the above example will appear on the screen as:
The name is John Smith
Using the MG Command to Configure Terminals
The MG command can be used to configure a terminal. Any ASCII character can be sent by using the format
{^n} where n is any integer between 1 and 255.
Example:
MG {^07} {^255}
sends the ASCII characters represented by 7 and 255 to the bus.
Summary of Message Functions:
Function
Description
" "
Surrounds text string
{Fn.m}
Formats numeric values in decimal n digits to the right of the decimal
point and m digits to the left
{$n.m}
Formats numeric values in hexadecimal
{^n}
Sends ASCII character specified by integer n
{N}
Suppresses carriage return/line feed
{Sn}
Sends the first n characters of a string variable, where n is 1 thru 6.
70 Chapter 5 Programming
RIO-47xxx
Содержание RIO-47120
Страница 2: ......
Страница 93: ...RIO Dimensions RIO 471xx Units in centimeters RIO 47xxx Appendix 87...
Страница 94: ...RIO 472xx Units in millimeters 88 Appendix RIO 47xxx...
Страница 107: ...Internal 56 64 Zero Stack 53 RIO 47xxx Index 101...