An axes-drawing program for the Hewlett Packard digital plotters

An axes-drawing program for the Hewlett Packard digital plotters. T. D. L. Pearson, and J. N. Demas. J. Chem. Educ. , 1983, 60 (7), p 568...
0 downloads 0 Views 1MB Size
Graphics Display Program for Zenith 2-19 Video Terminal Greg A. Gerhardt

University of Kansas, Lawrence, KS 66045 We have developed a FORTRAN graphics package for the Zenith Z-19 video terminal that uses the graphics character set of the Z-19 and generates a 72-line X 80 character display from a normal 24-line X 80-character screen. This note describes the software and its capabilities. The program GRAPHICS is designed to read and display previously stored X-Ydata arrays. It can also he incorporated into instructional or experimental programs that manipulated data in an X - Y format. The software is capable of handling u n t o 144 data ooints. but can he easilv altered to handle lareer sets. Data sets of greater than 72 points are automatically disolaved . " in two segments. The uroeram . - -generates and draws the axes, lahels and titles the graph, creates the data display, and automatically expands the X-Ydata to fill the screen. The increased line resolution is achieved by software selection of three graphics characters that differ only in their position on a line of the CRT. Careful selection of the characters allows for la cement of a data ooint a t the tov, middle, or bottom of a line. This effectively crkates a 72-line field from a 24-line terminal. The software is interactive and easy to use. There are only three commands: 1) "carriage return" to read another data file and display it; 2) " Q to quit the graphics program; and 3) "S" to segment the currently viewed data file and display an expanded portion of that file. This fast, simple, and versatile graphics package is suitable for displaying titration curves, spectra, calibration curves, and a variety of other X-Ydata; however, the video terminal is not a high resolution display, and the present software does not draw lines between the data points. We currently use this graphics package to display in viuo and in uitro electrochemistry data (concentration versus time). Examules of data disnlavs are seen in Fieures 8 and 9. range of the databoints. Figure 9 is an expanded segment of Figure 8 showing the software capability for viewing small portions of data sets and greatly enhancing the resolution of the data display. Program GRAPHICS-Microsoft FORTRAN-80 ver 3.13 has 357 statements and 110 comments. Program runs on a Cromemco 2-2 microcomputer with 56K of RAM, Zenith Z-19 video terminal, dual 8-inch f l o ~ p vdisks and CP/M o ~ e r a t i n p

Figure 8. In v i m electrochemistry data dlsplayed on a Zenith 2-19 video terminal.

568

Journal of Chemical Education

Figure 9. Expanded portion of the display shown in Figure 8

of ~ h e m i s t r y , ~ ~ n i v e r sofi t ~y a n s l sLawrence, , ~~'66045.

An Axes-Drawing Program for the Hewlett Packard Digital Plotters T. D. L. Pearson and J. N. Demas,

University of Virginia, Charlottesville. VA 22901 Properly drawn and labled axes on plots are essential for the proper visualization and comprehension of plotted results. On many computer-plotter systems, provisions for generating and laheline axes are minimal or nonexistent. For examole. our Hewlet;-~ackard 9825A computer-9872A digital plotter has svstem software for drawing axes with tics and numbering. Further, there are no provisions for automatically inserting centered lahels on each axis. Finallv, s ~ e c i a lsymbols frequently used in our work such as 6 ,h, ";and 6 could not be included in the lahels but had to be hand drafted later. T o alleviate these problems, we have developed a program AXES that has the ca~abilitvof drawing labeled axes with properly oriented numeration on the abscissa; it also has provisions for including special characters in the lahels. AXES was written in Hewlett Packard's BASIC-like HPL to run on a Hewlett Packard 9825A calculator controller with a large format (11 in. X 17 in.) Hewlett Packard 9872A digital plotter. Because many of the plotting complexities are handled by the intelligent plotter, little difficulty would he experienced adapting the program to high level languages on any other computer connected to the plotter. The smaller (8% in. x 11 in.), less expensive, Hewlett-Packard 7225A and 7470A digital plotters are software interchangeable with the 9872A plotter and produce equally acceptable plots. Figure 10 is a sample plot. The Greek symbols are nonstandard characters; other characters could easily be added as needed. Final plots are thesis (31) and journal (32) quality. The plotter pens are disposable and come in a variety of colors and widths for added versatility and include acetate marking pens for making transparencies. If default values are not to be used, the operator initializes the plot parameters before drawing any axes. Variables are the plotting speed, the tic length, the pen color, the coordinates of the corners, as well as the slant, height, and height/ width ratio of the characters. These parameters are maintained throughout the rest of the plot. Infunnation Ear each of the axes is then entered. This includes whether or not to draw the axis, where to place the tics on the axis, and where, ~~~

This

i

5

-4 -

3

.

,.

HJo

t h e UPPER o x i s .

-2 - 1 .

0

,

I

2

5

3

4

4

ui

2~

LL

5

1 -

;::I

m z

0

j

~4

B 3 c

1

5

N a n - s t a n d a r d characters:

c. I .

u,

u,

- 3 : ~2 % 1 U cc 0- 0

1:: 1 -1

I

,

,

,

,

,

E4 -5

,

,

,

,

-4

.

1

2

5 5

-4

3

-2 This

I 1s

0

1

the LOWER

2

3

4

5

0x1s.

Figure 10. Sample axesand labels generated using me program AXES. Our set of special characters is shown.

3500

3300

MASS OF Je = 6 2 . 1 I m U

(CM- I > ORIGIN

3100

2900

OF !ST OVERTONE = 8 1 1 0 8 C t l - l

Figure 11. Simulated infrared spectrum of fictitious molecule, N o .

and in what format, to place the numhering on the axes. The four corners of the desired plot are digitized on the plotter. This digitization is particularly useful for adding axes to plots prepared on other instruments since it permits aligning the axes to an existing plot. After the axes are drawn, labels can be added to any of them directly from the keyboard. Special characters are denoted by placing a code character in quotes, and those recognized hy our software are: rC'e"), ~("t"), d"un), v("vn), and 00"). Error checking insures that all special symbols used are defined and, in case of error, oermits the owerator to reenter a valuesberived from the axes parameters. The axis lahels are then drawn. When all of the axes and labels are drawn, the program permits repeating the plot of the same axes and labels. This allows the axes to be drawn and verified before placing them onto the final draft. The current program is written in BASIC-like HPL for the 9825A calculator. The Plotter-Advanced 110 and Advanced Programming-String 110 Read Only Memories (ROMs) are required. In other machines this would correspond to being ahle to transmit character strings to devices on the IEEE-488 bus, FOR-NEXT loops, and string handling. The customized characters are generated by taking advantage of the userdefined character command in the digital plotter by writing "UC" followed by the character specifications to the plotter. A program listing is availahle from J. N. Demas a t the above address. United States recipients please enclose a stamped self-addressed envelope. No postage is needed for international requests. The program can be copied by sending a carefully packed, new, certified cassette tape and $10 to J. N. Demas. We gratefully acknowledge support by the Air Force Office of Scientific Research (78-3590), the donors of the Petroleum Research Fund, administered by the American Chemical Society, and the DOE SERI Grant (DE-FG02-80CS84069).

analyzed is either that of HCI, HBr, or CO. We have written a program that generates a random set of molecular constants for a diatomic hydride, and then computes and plots the spectrum of the 1-0 vibrational hand. Each student can thereby be given an individualized spectrum to measure and process resulting in a generally more rewarding experience. To provide a personal touch, we name the second element of the molecule after the student. For example, a moleculecould he hydrogen joneside, HJo (see Figure 11). The program also will give the molecular constants on a separate sheet of paper

Re = 1.41 ANGSTROIIS ROTATIMIL-VIBRATIONIL COUPLING CONSTANT

0.16 C?tl

IR Spectrum of a Fictitious Hydride Michael 6. Moeller Unwersity of North Alabama. Florence, AL 35632

A common ~. r o.i e cin t undernraduate whvsical chemistrv is . .

Ih.

d

:~IK,I,