Print, Print -35, Purpose – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual

Page 185: Syntax, Example

Advertising
background image

Publication 1746-RM001A-US-P

Output Functions 12-35

PRINT

Purpose

Use the PRINT statement to direct the 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.

Syntax

PRINT

Example

>PRINT 10*10,3*3

100

9

>PRINT ”1746–BAS”

1746–BAS

>PRINT 5,1E3

5

1000

The symbols @ and # can be used to direct the print output to ports PRT1 and
PRT2 respectively.

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 module
resumes execution from the point at where it left off. The output
buffer of each port is capable of holding 256 characters. See
descriptions of CALLs 36, 37, 95, and 96 for more information.

Advertising