Plotting With Variables - HP 7470A Interfacing And Programming Manual

Graphic plotter
Hide thumbs Also See for HP 7470A:
Table of Contents

Advertisement

)
)
)
)
)
)
)
)
Error 3 will be set (parameter out of range). A PR command with out of
range parameters will still establish relative plotting mode for future
occurrences of PD or PU with parameters.
When scaling is off, in-range parameters are between —32 768 and
32 767. When scaling is on, in-range parameters and their plotter unit
equivalent must be between -32 768 and 32 767. To find plotter unit
equivalents, refer to the section Converting from User Units to Plotter
Units in Appendix C.
The following strings of HP-GL instructions, when sent to the plotter
using your computer's output statements, cause triangles to be drawn
that are identical to the ones previously drawn using only the PA in­
struction. The numbers in parentheses on the plot are the X,Y incre­
ments of the PR commands. The numbers without parentheses are the
plotter unit coordinates of the vertices.
" I N ; S P 1 ; "
" P A 2 0 0 0 , 1 5 0 0 , P D , P R - 2 0 0 0 , 0 , 2 0 0 0 , 2 0 0 0 , 0 , - 2 0 0 0 , PU, 5 0 0 , 0 ; "
" P D 2 0 0 0 , 0 , - 2 0 0 0 , 2 0 0 0 , 0 , - 2 0 0 0 , PU; "
2000 ,3500
(2000 .2000)
2500 , 3500
(-2000 , 2000)
START
2500 , 1500
2000 ,1500
(500 , 0)
(0 , -2000)
(0 , -2000) END
4500 , 1500
(2000 ,0)
•v
)
11
10
CONTROLLING THE PEN AND PLOTTING
a&itiisUitai
Plotting w i t h Variables
In many plotting applications, it is necessary to plot using variables
rather than fixed numbers to define the X- and Y-coordinate values.
The values of all HP-GL statement parameters have the same restric­
tions (integer or decimals in a valid range) when sent as variables as
when sent as literals (fixed numbers). The terminators and delimiters
of HP-GL statements must be sent to the plotter too. The method of
defining output format and variable precision varies from computer to
computer. Refer to your computer manual for the appropriate format
statements that may be needed in your program.
The following BASIC program illustrates the use of variables in plot­
ting a circle and shows how PRINT statements can be used to send
variables as parameters of HP-GL commands. You will use a similar
method if you are programming in another language. Quotation marks
are used by many computers and languages to delimit literal characters.
Note the comma in line 70, which is part of the HP-GL statement to be
sent to the plotter; it is specified as a literal in quotes. With the 7470, a
space may be substituted for the literal comma, shown in quotes. If
your computer automatically sends spaces between variables, these
spaces will delimit the coordinate parameters and a literal comma or
space will not be necessary. Since scaling is turned on in line 20, the
fractional portions of the variables X and Y are used by the plotter.
When the plotter is not in scaled mode, fractional portions are truncated
by the plotter. Unless you are writing software to be compatible with
other HP plotters such as the 9872, it is not necessary to add a
formatting statement to assure variables are sent as integers by your
computer.
To run this program, be sure to change line 10 as necessary for your
computer to define the plotter as the system printer. Also, if PI is not a
function recognized by your computer, add a line before line 40 to
define PI as a variable (PI = 3.1416).
10
PRINTER I S
7 0 5 , 8 0
20
PRINT
" I N ; S P 1 ; I P 1 0 0 0 , 1 0 0 0 , 6 0 0 0 , 6 0 0 0 ; "
30
PRINT
" S C O , 2 5 0 0 0 , 0 , 2 5 0 0 0 ; "
40
FOR T«0 TO 2 * P I + P I / 2 0 STEP P I / 2 0
50
X"4.5*1OOO*C0SCT)+1250O
60
Y - 4 . 5 * 1 0 0 0 * S I N ( T ) + 1 2 5 0 0
70
PRINT " P R " , X , " , " , Y , " ; P D ; "
80
NEXT T
90
PRINT " P U ; S P 0 ; "
100 END
CONTROLLING THE PEN AND PLOTTING
3-11

Advertisement

Table of Contents
loading

Table of Contents