HTBasic Help
×
Menu
Index

GRAPHICS INPUT IS

Defines the device to be used for graphic input.
 
 GRAPHICS INPUT IS device-selector, "driver-name [;options]"
 
Usage:
GRAPHICS INPUT IS KBD,"KBD"
GRAPHICS INPUT IS 705,"HPGL"
GRAPHICS INPUT IS 705,"TABLET;BIN-2,0,5000,0,5000"
 
Example:           GRAPHICS INPUT IS.BAS
 
Description:
This statement specifies which device and driver to use for DIGITIZE, READ LOCATOR and SET LOCATOR statements.
 
The device-selector specifies the device or interface to use to communicate with the graphic input device. This is usually KBD, an IEEE-488 device selector or the Serial interface select code. The driver name and options, shown in literal form in the above syntax diagram, can be specified with a string expression. The string specifies which driver to use with the device. The default device is KBD and the default driver is "KBD".
 
Graphics Input Drivers
HTBasic supports loadable graphics drivers. The first time a driver is specified in a GRAPHICS INPUT IS statement, the driver is loaded and used for graphics input. When the driver is subsequently specified, it is not loaded again, but is again used for graphics input. The following table lists the drivers available at the time of this manual printing. (Not all drivers are available in all versions.)
 
Name
For These Devices
KBD
Keyboard arrow keys or Mouse
HPGL
HPGL Plotters or Digitizers
TABLET
Most available digitizing tablets
 
HTBasic automatically loads the "KBD" driver when it starts. Up to ten graphic and dump drivers can be loaded at a time.
 
Driver files can be loaded at any point. It is recommended that GRAPHICS INPUT IS statements be included in your AUTOST file to load any necessary drivers.
 
To find the driver file HTBasic takes the driver specified in the GRAPHICS INPUT IS statement and performs several operations upon it to find the correct file. ".DW6" is appended to the name. Then the following locations are searched, in the specified order:
 
1. The directory containing the HTBasic executable.
2. The current directory.
3. The Windows system directory (such as \WINNT\SYSTEM32).
4. The Windows directory.
5. The directories listed in the PATH environment variable.
 

KBD Driver

The keyboard (KBD) graphics input driver provides support for input of X and Y coordinates from the keyboard arrow keys or the mouse. The KBD driver is loaded at start up. The command to switch back to the KBD graphics input driver from another driver is
 
GRAPHICS INPUT IS KBD,"KBD"
 
The following example program shows how to set up the KBD driver and get coordinate information from the input device.
 
10  PLOTTER IS CRT,"INTERNAL"
20  GRAPHICS INPUT IS KBD,"KBD"
30  TRACK CRT IS ON
40  FRAME
50  DIGITIZE X,Y,S$
60  PRINT X,Y,S$
70  END
 
HPGL Driver
The HPGL graphics input driver provides support for any input device that accepts Hewlett Packard's HPGL language. Some HPGL compatible devices are the HP 9111A and HPGL plotters.
 

TABLET Driver

The TABLET graphics input driver provides support for most digitizers currently available. It usually uses either the serial port or the IEEE-488 (GPIB) bus to communicate with the tablet. The following guidelines will help you in loading the driver and in selecting the proper tablet configuration and data communication options. The command to load the TABLET graphics input driver is:
 
GRAPHICS INPUT IS Isc,"TABLET;[mode[,]][resolution]"
 
The mode option allows you to specify the method in which the tablet's data is interpreted by the driver. If both mode and resolution options are specified, specify the mode option first and separate the two by a comma. The following table gives the legal values for mode:
 
Mode
Meaning
(None)
Comma separated ASCII
BIN-1
Summagraphics MM Binary Format
BIN-2
Hitachi Binary Format
BIN-3
UIOF Binary Format
 
If no mode is specified, then the driver assumes the tablet is using a comma separated, CR/LF terminated, ASCII data format. The data cannot contain any decimal points within the string. ASCII format is preferred over binary; it tends to be easier to setup and get working. The binary formats are explained in greater detail in the Getting Started Guide. The resolution option is sometimes necessary to scale X and Y values read from the tablet. The TABLET driver assumes a default maximum resolution of 11000 units in both the X and Y directions. This value is used to scale the digitizer coordinates to the display WINDOW coordinates. If this value is not correct for your digitizer or if you want to adjust for any distortion, you can change the scaling values with the following command:
 
GRAPHICS INPUT IS 9,"TABLET;Xmin,Xmax,Ymin,Ymax"
 
Xmin and Xmax are the digitizer's X values that correspond to the display's minimum and maximum X values respectively. Ymin and Ymax are the digitizer's Y values that correspond to the display's minimum and maximum Y values. Please note that these values are specified in device units.
 
The TABLET driver scales the digitizer X and Y coordinates into the display WINDOW coordinates. For example, suppose the screen's WINDOW resolution is 0-133 in the X direction and 0-100 in the Y direction and the digitizer's X and Y resolution is 0-11000. If the digitizer returns 11000,11000 as the current X and Y location, the DIGITIZE statement will return a value of 100,133 to the user. If you want the X and Y values to be the same for equal movements in the X and Y directions, specify a square WINDOW. For example:
 
WINDOW 0,100,0,100
 
The digitizer has two options that are critical to make it work properly with HTBasic. They are as follows:
•  Handshaking Mode
•  Absolute coordinates
 
Some other tablet settings that are not critical, but recommended are as follows:
•  Data transmitted only in proximity.
•  Disable Increment mode.
•  Disable leading zero's.
•  Enable RUN mode.
•  Enable Maximum report rate.
 
Please consult your digitizer documentation for the correct switch settings for these options.
 
Communication
The TABLET and HPGL drivers usually use either the serial port or the IEEE-488 (GPIB) bus to communicate with the digitizer. This is specified by the device-selector in the GRAPHICS INPUT IS statement. For example:
 
GRAPHICS INPUT IS 702,"TABLET" !GPIB Address 2
GRAPHICS INPUT IS 9,"TABLET"   !First Serial Port
 
Communication with the tablet over the GPIB bus is straight forward. You specify the device-selector (i.e. 702) and the control and data messages proceed without further setup.
 
Communication with the tablet over the serial port is more involved because of the many serial configuration options. The SERIAL driver defaults to 8 Data Bits, No Parity Bit, 1 Stop Bit and a speed of 9600 Baud. Make sure that the switches on the tablet are set to match these defaults or specify the differences when loading the SERIAL driver.
 
The tablet may support either XON/XOFF handshaking or hardware handshaking. Find out which method your tablet supports and set the SERIAL driver to use the same handshaking. By default the SERIAL driver uses XON/XOFF handshaking, the following line is all that is needed to set the driver to this method.
 
LOAD BIN "SERIAL" !Loads SERIAL device driver
 
If you need to use hardware handshaking, you will have to set a number of other registers within the SERIAL driver. The following program lines specify hardware handshaking.
 
10  LOAD BIN "SERIAL" !Loads SERIAL device driver
20  CONTROL 9,5;0     !Use DTR and RTS
30  CONTROL 9,12;0    !Read DSR, CD and CTS
40  CONTROL 9,100;0   !Disable XON/XOFF handshaking
 
With some digitizers the RTS line must be held active to make the TABLET driver work correctly, otherwise an error will occur after several successful reads. To hold the RTS line active change program line 20 to CONTROL 9,5;2. Make sure the tablet is set to hardware handshaking. For some tablets, this is specified as CTS handshaking.
 
Porting Issues
Both HP BASIC and HTBasic do an implicit GRAPHICS INPUT IS assignment for you if you attempt to use graphic input statements before an explicit GRAPHICS INPUT IS statement. The difference is that HTBasic does the implicit GRAPHICS INPUT IS as soon as HTBasic is started and HP BASIC waits until the first graphic input statement is executed. The only known effect of the different approach is that under HP BASIC, a SYSTEM$("GRAPHICS INPUT IS") returns "0" until the first graphic statement is executed and HTBasic returns the correct value anytime.
 
See Also: