Ph0. and ph1 – Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 179

Advertising
background image

Chapter
Statements

11

11 -27

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

The character H always prints after the number when you use PH0. or
PH1. to direct an output. The values are truncated integers. If the number
is not within the range of valid integers (ex. between 0 and 65535
[0FFFFH] inclusive), the BASIC module defaults to the normal mode of
print. If this happens an H does not print out after the value. Since you
enter integers in either decimal or hexadecimal form, you can use the
statements PRINT, PH0., and PH1. 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 BASIC module resumes execution from the
point where it left off. The transmit buffer of each port is capable of
holding 256 characters. See also the descriptions of CALLs 36 (page
12 -35), 37 (page 12 -35), 95 (page 13 -32), and 96 (page 13 -33).

Use the PH0#. and PH1#. operators to print to port PRT2 and the PH0@.
and PH1@. operators to read port PRT1.

Syntax

PH0.

number or expression

PH1.

number or expression

PH0.#

number or expression

PH1.#

number or expression

PH.0@

number or expression

PH1.@

number or expression

Example

>PH0.2*2

04H

>PH1.2*2

0004H

>PH0. 100

64H

>PH0. 1000

3E8H

>PH1. 1000

03E8H

>PH1. 3E8

3.0 E+8

PH0. and PH1.

Advertising