Print – Rockwell Automation 1771-DB BASIC MODULE User Manual
Page 181

Chapter
Statements
11
11 -29
Use the PRINT statement to direct the BASIC module to output a value to
the console device. You may print the value of expressions, strings, literal
values, variables or text strings. You may combine the various forms in the
print list by separating them with commas. If the list is terminated with a
comma, the carriage return/line feed is suppressed. P. is a shorthand
notation for PRINT. Values are printed next to one another with two
intervening blanks. A PRINT statement with no arguments sends a
carriage return/line feed sequence to the console device.
Important: The BASIC interpreter terminates the printing of a string if it
encounters a null (0), or CR (13) character. If you want to print strings
containing these values, print the characters individually inside of a loop
construct. To suppress the CR LF in the PRINT instruction, use a trailing
comma. Example: print A,
Important: You must ensure that buffer space is available anytime that
you are printing data out of the serial port using hardware handshaking or
software handshaking (XON/XOFF). Failure to do so causes the BASIC
program to stop executing while awaiting buffer space. When space is
available in the buffer, the BASIC module resumes execution from the
point where it left off. The output buffer of each port is capable of holding
256 characters. See descriptions of CALLs 36 (page 12 -35), 37 (page
12 -35), 95 (page 13 -32), and 96 (page 13 -33) for more information.
The symbols @ and # can be used to direct the print output to ports PRT1
and PRT2 respectively.
Syntax
Statement variation
Description
output a value to the console device
PRINT CR
output a carriage return without a line feed
PRINT SPC( )
output a specified number of spaces
PRINT TAB( )
output a specified number of tab characters
PRINT USING(Fx)
output all numeric values in scientific notation. The x represents the total
number of digits of the mantissa that are displayed. One digit is displayed
before the decimal point. The value of x is a minimum of three and a
maximum of eight. The value displayed is adjusted according to these limits.
PRINT USING(#.#)
output all numeric values in decimal notation according to the format specified
PRINT USING(0)
restore the default print mode if the mode was altered by the PRINT
USING(Fx) expression, or by the PRINT USING(#.#) expression.
Example
>PRINT 10*10,3*3
100 9