Ph0., ph1, Ph0., ph1 -37, Purpose – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual

Page 187

Advertising
background image

Publication 1746-RM001A-US-P

Output Functions 12-37

>1

REM EXAMPLE PROGRAM

>10 PRINT USING(###.##),

>20 PRINT 4.67890, 123.456

>30 PRINT .0123, .234

>40 PRINT 123.456, 2.1

READY

>RUN

4.67

123.45

0.01

0.23

123.45

2.10

READY

>

Use the PRINT USING(0) expression to restore the default print mode if the
mode was altered by the PRINT USING(Fx) expression, or by the PRINT
USING(#.#) expression.

PH0., PH1.

Purpose

Use the PH0. and PH1. statements to direct the module to output a hexadecimal
value to the console device. These statements function the same as the PRINT
statement except that the values are printed out in a hexadecimal format. The PH0.
statement suppresses two leading zeros if the number printed is less than 255
(0FFH). The PH1. statement always prints out four hexadecimal digits.

The character H is always printed after the number when PH0. or PH1. is used to
direct an output. The values printed are always truncated integers. If the number
printed is not within the range of valid integer (example: is between 0 and 65535
[0FFFFH] inclusive), the module defaults to the normal mode of print. If this
happens no H prints out after the value. Since integers are entered in either decimal
or hexadecimal form, the statements PRINT, PH0., and PH1. can be used to
perform decimal to hexadecimal and hexadecimal to decimal conversion. All
comments that apply to the PRINT statement apply to the PH0. and PH1.
statements.

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