
BASIC commands
PROGRAMMING MANUAL
162
R
e
vi
si
o
n
1
.0
3.2.228 PRINT
/i
/i
/i
3.2.229 PROC
/i
See also
N/A
Type
Communication command
Syntax
PRINT [ #n, ] expression { , expression}
? [ #n, ] expression { , expression }
Description
The
command outputs a series of characters to the communication
ports.
can output parameters, fixed ASCII strings, and single ASCII
characters. By using
PRINT #n
, any port can be selected to output the infor-
mation to.
Multiple items to be printed can be put on the same line separated by a
comma or a semi-colon. A comma separator in the print command places a
tab between the printed items. The semi-colon separator prints the next item
without any spaces between printed items.
The width of the field in which a number is printed can be set with the use of
[w,x] after the number to be printed. The width of the column is given by w and
the number of decimal places is given by x. Using only one parameter [x]
takes the default width and specifies the number of decimal places to be
printed. The numbers are right aligned in the field with any unused leading
characters being filled with spaces. If the number is too long, then the field will
be filled with asterisks to signify that there was not sufficient space to display
the number. The maximum field width allowable is 127 characters.
The backslash
\
command can be used to print a single ASCII character.
Arguments
•
n
The specified output device. When this argument is omitted, the port as
specified by
OUTDEVICE
will be used. See the table below.
Value
Description
0
Programming port 0 (default)
1
RS-232C serial port 1
2
RS-422A/485 serial port 2
5
Trajexia Studio port 0 user channel 5
6
Trajexia Studio port 0 user channel 6
7
Trajexia Studio port 0 user channel 7
•
expression
The expression to be printed.
Example
PRINT "CAPITALS and lower case CAN BE PRINTED"
Example
Consider VR(1) = 6 and
variab
= 1.5, the print output will be as follows:
PRINT 123.45, VR(1)-variab
123.4500 4.5000
Example
length:
PRINT "DISTANCE = ";mpos
DISTANCE = 123.0000
In this example, the semi-colon separator is used. This does not tab into the
next column, allowing the programmer more freedom in where the print items
are placed.
Example
PRINT VR(1)[ 4,1 ]; variab[ 6,2 ]
6.0 1.50
Example
params:
PRINT "DISTANCE = ";mpos[ 0 ];" SPEED = ";v[ 2 ];
DISTANCE = 123 SPEED = 12.34
Example
PRINT "ITEM ";total" OF ";limit;CHR(13);
Example
>> PRINT HEX(15),HEX(-2)
F 1FFFFFFFFFFFFE
See also
$ (HEXADECIMAL INPUT)
,
OUTDEVICE
.
Type
Task command
Syntax
PROC(task_number)
Value
Description