Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 6 of 23

VRC 4000 Software Driver Manual: Chapter 2 TBDriver Touchscreen Driver for DOS, pages 43 to 52

Pages 43 to 52 of 206, from VRC 4000 Software Driver Manual

The original document is the PDF (1.2 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Symbol VRC-4000

Page 43

Chapter 2 TBDriver Touchscreen Driver for DOS Contents Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5 Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8 Application Programming Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8 Touch Input Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8 Application Programming Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-17 Before Calling The API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-17 Loading and Unloading TBDRIVER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-47 The TBdriver Command Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-47 Unloading TBdriver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-52 TBdriver Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-53 TBdriver Return Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-55 The TBdriver Demonstration Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-56 The TBdriver Calibration Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-61 Hard Calibrate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-62 Options 1 - 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-62 Test Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-64 Customize Video Mode Mappings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-65 Troubleshooting and Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-68 TBDIAG - The Touchscreen Diagnostic Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-69 The TBdiag Command Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-69 How To Contact Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-71 TBMOUSE - The Mouse Emulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-72 The TBmouse Command Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-73 Button Emulation Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-74 The Mouse Cursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-74 Absolute Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-75 Relative Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-75 The Mickey to Pixel Ratio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-75 Initial Virtual Screen Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-77 Initial cursor position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-77 Incremental Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-77 Alternate Interpretation of x,y Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-78

2-1

Page 44

VRC 4000 Software Driver Manual

Ignoring Touches Outside x,y Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-78 Stack Switching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-78 The Z Axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-78 Acceleration and Other Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-78 Unloading TBmouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-79 TBmouse Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-79 Return Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-81 TBmouse Extended Application Program Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-82 TBmouse Application Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-87 TBPAD - The Keyboard Emulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-88 The TBpad Demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-88 The TBpad Application Programming Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-94

2-2

Page 45

Chapter 2: TBDriver Touchscreen Driver for DOS

Introduction A touchscreen is one of the most technically sophisticated yet easiest to use input devices available today. Many different types are available, but the end result is the same: you touch the visual images you see, and the computer responds. A touchscreen is a hardware device which is physically attached to the computer's monitor and can accurately sense the position of a touch. Traditionally, touchscreens were sold as a purely hardware product, and applications tended to interface directly with the hardware, sometimes with unsatisfactory results. Recognizing the disadvantages of this approach, most manufacturers do now provide drivers with their touchscreens, and virtually all modern touchscreen applications use a driver of some sort to insulate the application programmer from the worst of the low level programming. Some touchscreen drivers are relatively simple data capture and packet interpretation utilities, and do little to provide real performance, resilience and flexibility. TBdriver is at the other end of the scale, providing an extensive range of facilities and a rich Application Programming Interface. TBdriver also offers an important advantage over any other touchscreen driver. Each of the growing number of touchscreens on the market uses a different interface protocol, but TBdriver maps them all to an identical API. An application written to the TBdriver API will automatically work with any of the touchscreens TBdriver supports. That gives you, your application, and your users a valuable edge in today's tough commercial world. TBdriver takes care of all the complexities of touchscreen initialization, interrupt handling, touch buffering, calibration, orientation, scaling and more. It presents all its functions as a logical, fully documented and consistent API, saving the application programmer a great deal of time and effort. The major features of TBdriver are summarized below. • Supports all touchscreens with an identical API • Low memory overhead (around 6K) • Written in Assembler and interrupt driven for performance • Logical touch buffering for touch-ahead capability • Well defined logical data stream presented to the API

2-3

Page 46

VRC 4000 Software Driver Manual

• Resolves touches to application defined rectangular 'pads' if required • Variable off-touch sensitivity • Optional coordinate stabilization to control jitter • Variable X, Y, Z scales and origin • Hard and soft calibration • Automatic re-calibration on change of video mode • Application defined and user defined calibrations • Automatic screen orientation adjustment • Automatic re-initialization of touchscreen after power off/on • Time axis - timing of stationary touches • Applications can poll for touches, or be event driven • Extensive API, accessible from any programming language • Configurable API interrupt vector • Handles COM1 - COM8 or non-standard serial port configurations • Handles IRQ sharing and 'Global Rearming' • Takes advantage of buffered serial port chips (16550A) • Fully configurable communications parameters • Touchscreen data packet validation protects against errors caused by lost interrupts and transmission errors • Unloads from memory by command argument or API call • Mouse emulation utility for driving DOS mouse applications • Keyboard emulation utility for driving DOS keyboard applications • Demonstration and calibration utility programs • Serial data diagnostic program • Example application source code in several languages • Full documentation • Support and advice from independent experts in touch

Welcome to the world of real touchscreen programming!

2-4

Page 47

Chapter 2: TBDriver Touchscreen Driver for DOS

Getting Started TBdriver is intended for use on IBM PC, XT, AT, PS/2 or compatibles running DOS 2.x or greater. The TBdriver distribution diskette contains the following files: • Readme.dvr

The latest information on TBdriver

• Install.exe

Installation program

• TBdriver.lzh

Compressed drivers and utility programs

• Extras.lzh

Compressed paint drawing and prototyping tool

We recommend that you make a backup copy of the distribution diskette as soon as you receive it. To install the driver, simply insert the diskette and type: driveid: install where driveid is the diskette drive id. First, you will be asked to select the type of touchscreen you are using from a picklist of supported types. You are then presented with another picklist which allows you to select the pathname of the directory you wish the software to be installed and the level of installation you require. The return key toggles the selection on or off. Default installation options are as follows: Base directory

C:\TOUCH

Base Directory

Install driver

Yes

TBdriver

Install utilities

Yes

TBdriver Utilities

Install examples

Yes

Example Applications

Install TBpad

Yes

Keyboard Emulation Utility

Professional Touch

Yes

Prototyping Tool

Install TBpaint

Yes

Paint Package

Start Installation Select the last entry of the picklist to being installation.

2-5

Page 48

VRC 4000 Software Driver Manual

The following files are installed by a full installation: Readme.dvr TBdriver.exe TBmouse.exe TBcal.exe TBddemo.exe TBdiag.exe

Text file containing additional information The DOS touchscreen driver program The DOS mouse emulator The TBdriver calibration program The TBdriver demonstration program The serial data diagnostic program

In subdirectory Examples: TBdex.pas TBdex.exe TBdex2.pas TBdex3.pas TBdex.c TBdex2.c TBdex.bas TBdex.cbl Intr.obj Intr.doc

Pascal example source program Compiled Pascal example Event driven Pascal example Example of driving two touchscreens C example source program Event driven C example Basic example source program Cobol example source program Software interrupt interface for Cobol Documentation for Intr.obj

In subdirectory TBpad: TBpad.exe TBpad.dem TBkey.exe Paddemo.bat

The keystroke emulator Example pad definition file Utility to identify keyboard scan codes Batch file to run TBpad demonstration

In subdirectory Protouch: Protouch.* Proedit.*

Professional Touch is a touchscreen application prototyping tool. See the file protouch.doc

TBgrab.exe TBmousec.exe *.bgi *.chr for full product details.

In subdirectory TBpaint: 2-6

Page 49

Chapter 2: TBDriver Touchscreen Driver for DOS

TBpaint.exe TBpaint.doc *.bgi *.chr

TBpaint is a touch painting package. See TBpaint.doc for full product details.

Please read the readme.dvr file as it may contain important information concerning the software which was not available in time to be included in this manual. The ’Hardware Configuration’ section contains full details on loading TBdriver, but for most purposes you simply type: TBdriver c where c is the number of the COM port which the touchscreen is connected to. You must then hard calibrate the system using TBcal, option H. If you wish, you can then run TBddemo and explore the features of TBdriver by trying them.

2-7

Page 50

VRC 4000 Software Driver Manual

Concepts Application Programming Interface TBdriver is a Terminate Stay Resident program. You load it by running it before your application, and it remains in low memory until you unload it or reboot the machine. Your application program interfaces to TBdriver by calling a software interrupt specifying the function code and parameters in the processor registers. On return from the call, the registers contain the results of the function. This is a very common type of interface mechanism under DOS, and most programming languages offer good facilities for using it. The default software interrupt used is 66 hex, but this can be altered by means of environment variable TBdint, as described in ’Hardware Configuration’.

Touch Input Data At the most basic level, a touchscreen application needs to know the horizontal and vertical position of a finger touching the screen, and this information takes the form of a pair of X and Y coordinates, where the origin is arbitrarily predefined as the top left hand corner. Experience soon shows, however, that it is useful to know a little more, such as the location of the initial point of contact, the final point of contact, or that the finger is not presently touching. TBdriver handles this by reporting a touch type with every pair of X and Y coordinates. There are four touch types: A First touch is reported for the initial point of contact with the screen. Only one of these is reported for each touch. A Repeat touch is reported every time the application reads the driver while the finger remains on the screen. The coordinates associated with the touch may change, of course, as the finger slides around the screen. A Last touch is reported for the point at which the finger breaks its contact with the screen. Again, there can only be one of these for each touch. A No touch is reported whenever the application reads the driver and the screen is not being touched. The X,Y coordinates are irrelevant to this type of response.

2-8

Page 51

Chapter 2: TBDriver Touchscreen Driver for DOS

One of the TBdriver API calls allows the application to read the touchscreen, and this operation returns the following data: • A touch type • The X coordinate (left to right) • The Y coordinate (top to bottom) • The Z coordinate (pressure), if supported by the hardware • The Time coordinate (see later) • The Pad number (see later) • The Raw coordinates

Scales and the Origin It is useful for the application to be able to define the X and Y scales of the touch coordinates returned by the driver, for example to match the pixel resolution of the current graphics mode, or the number of lines and columns in a text mode. By default, TBdriver uses a scale of 1000 x 1000 and an origin of 0, which means that the top left hand corner is defined by coordinates 0,0 and the bottom right hand corner is defined by coordinates 999,999. One of the TBdriver API calls allows the application to specify the scales and origin to be used. After this call, all subsequent touch coordinates will automatically be mapped to the new scales. A text mode application might, for example, define a scale of 80 x 25 with an origin of 1,1, so that TBdriver returns the line and column numbers of the character touched. A graphics application might define a scale of 640 x 350 with an origin of 0,0, in which case the driver would return the pixel coordinates touched.

Touch Buffering Just as you sometimes want to 'type ahead' of a program on a keyboard, you sometimes want to 'touch ahead' of a program on a touch screen. The absence of this facility can be a source of extreme frustration for an experienced user who frequently inputs a lot of data. TBdriver buffers up to 25 touches, after which the buffer wraps around, overwriting the oldest touch.

2-9

Page 52

VRC 4000 Software Driver Manual

Touch buffering affects the touch types reported to the application. For example, it would make no sense to buffer repeat touches, since these are only relevant when an application is responding to them in real time. Similarly, there is no point in buffering no touches, since it makes no sense for an application to do nothing for the time it takes to read the next packet from the buffer. TBdriver only buffers first and last touches. Repeat and no conditions are only reported if they exist at the moment the application reads the driver. The application can remain completely unaware that buffering is taking place. It simply has to know how to handle all four types of packet, and TBdriver takes care of the buffering. There are times, of course, when buffered touches would be meaningless or undesirable, so one of the API calls allows the application to flush out the touch buffer.

Calibration A calibration procedure must be carried out to enable the driver to map the touch coordinate onto the visual image. In order for this to be done accurately at all times, two types of calibration are needed: hard calibration and soft calibration.

Hard Calibration Hard calibration must always be performed on a newly assembled system. Hard calibration gives TBdriver vital reference information about the orientation of the touchscreen and the extents of its raw coordinates. Hard calibration involves touching the bottom left hand corner, followed by the top right hand corner of the visual image, which gives the system sufficient information to determine the position of the four edges. TBdriver can also deduce from these two touches whether the coordinates of either axis need to be inverted in order to make the origin the top left hand corner. Some touchscreens are capable of being installed either way up on the monitor face, and TBdriver is able to compensate for this after hard calibration. After hard calibration, any touches outside the calibrated edges are assigned the appropriate edge coordinates.

2-10