C-PLOT

Scientific Graphics and Data Analysis

8.2. - in open and initialize pen plotter



opens an input-output channel to the pen plotter. Once you have opened the plotter using this command, you will be able to use the drawing commands to make plots. Invoking this command when the plotter is already opened reinitializes the plotter.
in [device] [baud]
or
in m
Without an argument, in attempts to establish an input-output channel with the name assigned to the variable DEVICE in the cplot_config file. If the device is on a serial interface, the baud rate is also taken from the variable BAUD in that file. (See Appendix A for an explanation of the cplot_config site-initialization file.) You also can select the device name or baud rate or both by entering them as arguments after in. Once the device or baud rate is selected as an option to in, C-PLOT disregards the values from the cplot_config file.

If you enter in m, the program assumes the pen plotter is sharing a serial line to the computer with your terminal. This only works with pen plotters that implement eavesdropping mode and have been connected to the terminal and computer with a special Y-cable. (The switch on the back of plotter with the markings D and Y should be in the Y position for eavesdropping mode.)

When not using eavesdropping mode, the program treats serial and GPIB (General Purpose Interface Bus) interfaces differently. The interface used is established in the cplot_config file according to the value of the variable GPIB. With a serial interface, the program uses ioctl() system calls to set the baud rate, turn off echoing, turn on XON-XOFF flow control and so on for the line to the plotter. (The tty modes of the serial line are reset to their initial values when C-PLOT exits or the plotter is released.) The baud rate is taken from the value of BAUD in the cplot_config file. When the device is opened, the program sends out special HP-GL commands to configure the serial interface on the plotter. The program does not do anything to configure a GPIB interface.

The following paragraphs describe the sequence of events when C-PLOT opens and initializes the pen plotter. From this list, you may be able to determine what is going wrong when the program cannot open the plotter.

1) C-PLOT tries to open the special file whose name (for example, /dev/plotter) is given in the cplot_config file or as an argument to the in command. The open can fail if the name doesn't exist, the name isn't a character-type special file, you don't have read and write permission for that special file or the device has been locked by another user (if your system uses the exclusive use method of locking).

2) C-PLOT checks to see if the plotter has been locked using the lockf() system call (if your system uses this method). If the plotter is locked, you will not be able to gain control until it has been unlocked by the other user. Otherwise, the program locks the plotter to keep other users off.

3) If the serial interface is used (but not in eavesdropping mode), the baud rate and line modes are set.

4) For serial devices, a reset message and the handshake parameters are sent.

5) A message is sent asking the plotter to output its error status. If the plotter doesn't respond within three seconds, C-PLOT assumes there is no plotter and tells you so.

6) C-PLOT asks the plotter for more information about itself, including the size of the maximum plotting area. Subsequent plots drawn using a graphics filter will be scaled so that the plotter's maximum plotting area will be mapped onto the filter's maximum plotting area.