The text of a manual · part 10 of 23
VRC 4000 Software Driver Manual: Chapter 2 TBDriver Touchscreen Driver for DOS, pages 83 to 92
Pages 83 to 92 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 83
Chapter 2: TBDriver Touchscreen Driver for DOS
Prior to calling the user ISR, TBdriver will automatically load the DS register with the user data segment address specified here in register DX. The application will therefore have access to its variables immediately upon invocation. TBdriver saves all registers prior to calling the user ISR, and restores them after the call. The ISR is called with interrupts enabled. It must exit with a far return. The user ISR is called with the AL register equal to 'F' for a First touch, or 'L' for a Last touch. BX and CX are the X and Y coordinates of the touch. The user ISR may make any TBdriver API calls, since the API is fully reentrant, although it would be illogical to de-queue touches. It must not make any DOS or BIOS calls, and care must be taken not to re-enter any non-reentrant parts of the application. TBdriver will not re-enter the user ISR, or inter-call the Pre-processing user ISR and the Event user ISR. The user ISR is not called if its segment address is zero. The application must reset the user ISR address to zero before terminating. TBddemo has two options which demonstrate this feature. Option 'K' sets a pre-processing user ISR which beeps and displays the touch event in the bottom right hand corner of the screen. Option 'L' disables the ISR, as does exiting the program.
2-41
Page 84
VRC 4000 Software Driver Manual
Function: Soft Calibrate Calling Sequence: AL = 0A hex Call API interrupt <First touch> AL = 0B hex AH = 0 for calibration using extreme corners 1 for calibration using points 20% in BL = 0 (reserved for future use) Call API interrupt <Second touch>
Return Values:
(Both calls) AH = 0 if successful 1 if BL not 0 on entry 2 if current video mode unsupported 3 if AH not 0 or 1 on entry 4 if not hard calibrated yet 5 if touches too close 6 if user aborted by pressing a key 7 if no touch after 30 seconds
Description:
These two calls simplify the implementation of soft calibration routines in applications. The Read Soft Calibration Coordinates, Activate Soft Calibration Coordinates, De-Activate Soft Calibration, and Update Soft Calibration Coordinates API calls are no longer required as these new, simpler calls should be used instead. The first call waits for a touch either at the bottom left corner of the screen or 20% away from it, returning when the touch is removed. The second call waits for a touch either at the top right of the screen or 20% away. If the touches are acceptable, TBdriver updates the TBcalib file and activates the new calibration. The calibration mode updated is defined by the video mode mapping table described in the ’Co-existence with Mice’ section.
2-42
Page 85
Chapter 2: TBDriver Touchscreen Driver for DOS
Before the first call, the application should direct the user to touch a point displayed at the bottom left of the screen, or 20% away from it. On return from the first call, the application should clear the point drawn at the bottom left and draw a new one at the top right. On return from the second call, calibration is complete. It is usually more accurate to use calibration points 20% away from the edges of the extreme corners, the location of the points being: First point (20% from bottom left): Xmax * 20/100, Ymax * 80/100 Second point (20% from top right): Xmax * 80/100, Ymax * 20/100
2-43
Page 86
VRC 4000 Software Driver Manual
Function: Unload Calling Sequence: AL = 16 hex Call API interrupt
Return Values:
AH = 1 if successfully unloaded 0 if unable to unload
Description:
Restores interrupt vectors and returns TBdriver's memory to DOS. Unloading is not possible if any of TBdriver's interrupt vectors have been 'hooked' by another program.
2-44
Page 87
Chapter 2: TBDriver Touchscreen Driver for DOS
Function: Update Soft Calibration Calling Sequence: AL = 24 hex AH BX CX DX ES
= = = = =
Calibration mode X1 (Left edge) Y1 (Bottom edge) X2 (Right edge) Y2 (Top edge )
Call API interrupt
Return Values:
None
Description:
Updates the soft calibration held in memory within TBdriver for the calibration mode specified, replacing the values loaded from the TBcalib file. If the specified mode matches the current video mode of the system, the new calibration takes effect immediately. The calibration mode numbers are the same as those defined for the Get Current Calibration call. For most purposes, the usage of this call has been superseded by the Soft Calibrate API call.
Notes:
The application is responsible for updating the TBdriver calibration file, TBcalib, if the new calibration coordinates are to be preserved for the next loading of TBdriver.
2-45
Page 88
VRC 4000 Software Driver Manual
Loading and Unloading TBDRIVER The TBdriver Command Line TBdriver[Port] [/A:addr] [/C:bbbb,p,d,s] [/D] [/H] [/G] [/I:irq] [/S:nn] [/T:nn] [/E:hhhhh...] [/V] [/NI]
Port
Specifies a serial port (1 .. 8) /A:addr Port address (0000 - FFFF hexadecimal) /C:bbbb,p,d,s Communications parameters. Can be used to override the default baud, parity, databits and stopbits: bbbb Baud rate (1200, 2400, 4800, 9600) p Parity (N, O, E) d Databits (7, 8) s Stopbits (1, 2) /D Disable automatic re-initialization /H Standard IRQ sHaring /G IRQ sharing with Global rearming /I:irq Interrupt request number (0 .. 15) /S:nn Sensitivity value (1 .. 20) /T:nn Stabilization factor (0 .. 20) /E:hhhhhh...Extra initialization. Specifies additional hex characters to be sent to the touchscreen after normal initialization. Serial touchscreens only. /V Use clock vector 1C instead of 8. /NI No touchscreen initialization to be performed.
TBdriver /?
Prints the above summary
TBdriver U
Unloads TBdriver from memory
Most of these options are only rarely required. In most cases all that is required is simply: TBdriver 1 2-46
For a touchscreen on COM1, or:
Page 89
Chapter 2: TBDriver Touchscreen Driver for DOS
TBdriver 2
For a touchscreen on COM2.
Non-Standard Serial Port Configurations TBdriver also supports COM3 to COM8, although these are not as well defined as COM1 and COM2. By default, TBdriver defines the COM ports as follows: COM1: COM2: COM3: COM4: COM5: COM6: COM7: COM8:
Port Address 3F8 Port Address 2F8 Port Address 3E8 Port Address 2E8 Port Address 4220 Port Address 4228 Port Address 5220 Port Address 5228
IRQ 4 IRQ 3 IRQ 5 IRQ 2 IRQ 3 IRQ 3 IRQ 3 IRQ 3
In order to provide complete flexibility of serial port configurations, TBdriver allows the port address and IRQ number to be overridden explicitly using the /a and /i parameters. For example: TBDRIVER 5 /A:748 /I:10
Defines a COM port at address 748 on IRQ 10
In practice, usage of COM3 to 8 will often require explicit specification of the port address and IRQ.
BIOS COM Port Base Address Table Normally, when TBdriver loads, it zeros out the entry in this table for the COM port in use, and restores it when it unloads. However, it only does this for COM1 to COM4, and then only if the address in the BIOS table matches the actual port address in use. So if, for some reason, you wanted to load TBdriver on COM1 without zeroing out the BIOS COM table, you could do so by loading “TBdriver 5 /a:3F8 /i:4”.
Bus Controller Configurations For bus controller touchscreens, the COM port parameter is ignored, and TBdriver will default to the factory settings of port address and IRQ. Again, the /a and /i parameters may be used to specify unusual configurations.
2-47
Page 90
VRC 4000 Software Driver Manual
Automatic Re-initialization Some touchscreen controllers require a software initialization sequence to set them into the required operating mode, and TBdriver always performs this when it loads. When the controller is serially connected and external to the PC, there is always the possibility that the user will power the touchscreen controller off and on, particularly if the controller is located inside the monitor. The controller will then power up uninitialized and will not work. For certain touchscreens then, TBdriver monitors the Clear To Send RS232 signal in an attempt to detect if the controller is powered off and on. On a low to high transition of CTS, TBdriver automatically initiates the controller initialization process. This usually has the effect of recovering from a touchscreen controller power off/on within a few seconds. However, certain conditions can cause this process to be falsely triggered, and hence this feature can be switched off by specifying the /D parameter when loading TBdriver. Please note that while TBdriver is attempting to re-initialize the touchscreen, it can cause the system to slow down considerably.
Communications Parameters TBdriver chooses default communications parameters which are either the only ones supported by the touchscreen, or which will be automatically recognized by the touchscreen, or which can be used with the switch settings defined in Appendix B. The TBdriver Install program displays the default communications parameters after completing installation. You may wish to change the communications parameters to support different switch settings, or even to reduce the communications overhead. This can be done using the /C parameter. For example: TBDRIVER /C:4800,O,7,1
Use 4800 baud, odd parity, 7 data bits, 1 stop bit.
Note that all elements of the /C parameter must be specified.
2-48
Page 91
Chapter 2: TBDriver Touchscreen Driver for DOS
Sensitivity and Stabilization TBdriver chooses default stabilization and sensitivity values to give optimum performance for the touchscreen in use. You can determine the default values by loading TBdriver and running TBddemo, which displays the current stabilization and sensitivity settings. If required the /S and /T parameters can be used to override the default initial settings. This has no effect on subsequent Set Sensitivity or Set Stabilization API calls.
Shared IRQ's and Global Rearming For serial touchscreens only, TBdriver supports the ability for more than one COM port to share the same IRQ. For hardware reasons, this only works when the hardware is designed to support IRQ sharing, for example on multiport serial adapter cards. IRQ sharing cannot be made to work by simply switching two ordinary COM ports to the same IRQ. When TBdriver is loaded with /H, it processes any data available at its serial port, if any, and then calls any other interrupt service routines which were loaded before it on the same IRQ. It does not send an EOI to the PIC. When loading multiple TBdrivers on the same IRQ, the first should be loaded without /H, so that it performs an EOI and a simple IRET. Subsequent TBdrivers should be loaded with /H. For example: TBdriver /a:740 /i:10
Load first TBdriver on irq 10 set TBdint=65
Change the TBdriver API vector set TBdpath=c:\touch2
Change the calibration file path
TBdriver /a:748 /i:10 /h
Load second TBdriver on irq 10
The example program TBDEX3.PAS shows an example of using two TBdrivers. Interrupts may be shared with non-sharing-aware applications, by loading the non-sharing-aware application before TBdriver, and then loading TBdriver with /H.
2-49
Page 92
VRC 4000 Software Driver Manual
The Global Rearm IRQ-sharing mechanism found on an increasing number of machines is also supported, using the /G parameter. If Global Rearm IRQsharing is required, /G should be specified instead of /H. /G and /H are mutually exclusive.
Location of the Calibration Data File TBdriver maintains a calibration data file called TBcalib, which it must be able to locate when it loads. If TBcalib does not exist when TBdriver loads, it is created, with null calibration data. It will then be necessary to recalibrate. Unless the environment variable TBdpath is used, the file is located in the directory which is current when TBdriver loads. Unless you use the TBdpath environment variable, you must always load TBdriver from the same current directory, in order that TBdriver can locate the TBcalib file. If an invalid TBcalib file is detected when TBdriver loads, it is automatically deleted, and a message displayed. This happens when you change touchscreen type, or when the TBcalib file format changes due to an upgrade.
Environment Variables If TBdriver is loaded with no parameters, the default COM port number is 1, but this can be changed by means of environment variable TBdcom, for example, the DOS command: SET TBdcom=2 would change the default COM port number to 2. Note that a value specified on the TBdriver command line takes precedence, if specified. The default software interrupt vector number of 66 hex may be changed by environment variable TBdint, for example, the DOS command: SET TBdint=63 would change the software interrupt vector number to 63 hex. There is no command line argument to override this. Values of 60 to 66 hex are allowed. The location of the calibration data file can be specified by environment variable TBdpath, for example, the DOS command:
2-50