:: Style
:: Using a Touchscreen with CORTEX on a Dual Computer Setup  
Prior to Cortex version C57R10, a touchscreen could only function properly on a single computer Cortex setup. For release C57R10 (and later), the dual computer version of Cortex also works properly with a touchscreen. The code was written for and tested on a Microtouch touchscreen.

Please refer to the document entitled "Dual Computer Cortex Installation Instructions" for the basic dual computer installation instructions. If you have never set up a dual computer version of Cortex before, you may want to set up a basic system first before attempting to use the touchscreen.

:: Hardware Setup  
On the receive computer:
  1. Connect the Microtouch touchscreen graphics cable to the video card in the receive computer.
  2. Connect COM1 on the receive computer to COM1 on the send computer via serial cable (for Cortex communication).
  3. Install Scitech Display Doctor.
On the send computer.
  1. Connect the Microtouch touchscreen controller serial cable to COM2 on the send computer.
  2. Connect COM1 on the send computer to COM1 on the receive computer via serial cable (for Cortex communication).
  3. Install Microtouch Touchware DOS driver software (see section below).
(Note: The above instructions were simplified by assuming that COM1 is used for the Cortex communications port. However, COM2 can also be used for the Cortex communication. The send and receive sides of the Cortex program use COM1 as the default. The send side can be changed to COM2 in CORTEX.CFG with the COM_PORT parameter. The receive side must be changed with a command line argument. That is, if you wanted to use COM2 on the receive computer, you would type "rvesactx COM2". Therefore, any of the following combinations will work properly: COM1-->COM1, COM1-->COM2, COM2-->COM2, and COM2-->COM1.)

:: Microtouch Touchware Setup  
The latest Microtouch Touchware driver software is available from the Microtouch web site (http://www.microtouch.com). You MUST install the DOS version of the Touchware driver. Currently, the software driver version is Touchware 3.4. You will also want to download the latest version of Microcal (currently, version 7.0).
  1. Reboot the send computer into DOS, since Touchware must install and run from DOS. During Touchware installation, the driver tries to find the touchscreen controller. If it does not find the controller, run microcal.exe. If microcal.exe finds the controller, write down the settings for the communications port number, the IRQ number, and the baud rate. Edit the file DOSTOUCH.INI, and replace the current values with the ones reported by microcal. You should now be able to run the Touchware driver (DOSTOUCH.EXE), and it should report that the driver was installed.
  2. Calibrate the monitor using microcal.exe on the send computer. Be aware that the calibration screen will appear on the send computer's display...not the touchscreen! However, if you touch the corners of the touchscreen, it should be detected properly. For a more accurate calibration, you can temporarily attach the touchscreen video cable to the video card of your send computer (instead of your normal send computer monitor). This will allow you to see the calibration markers on the touchscreen itself while running microcal.exe.
  3. To work properly with Cortex, it is suggested that you edit the DOSTOUCH.INI to contain the following values:
    • DefaultVirtualSize=640 480 (This allows the touchscreen to map the touch from (0,0)(999,999) to the required (0,0) (640, 480).)
    • CursorOffset=0 (so that when the screen is touched, no value is added to the location
  4. You may also want to experiment with the TouchMode value in the DOSTOUCH.INI file. These values can be changed by running the DOSPANEL.EXE program.
  5. Before running Cortex, you must always boot up your computer into DOS and run the DOSTOUCH.EXE driver on the send computer.

:: Using a Touchscreen with Dual Computer Cortex  
Prior to Cortex version C57R10, a touchscreen could only function properly on a single computer Cortex setup. For release C57R10 (and later), the dual computer version of Cortex also works properly with a touchscreen. The code was written for and tested on a Microtouch touchscreen.

Please refer to the document entitled "Dual Computer Cortex Installation Instructions" for the basic dual computer installation instructions. If you have never set up a dual computer version of Cortex before, you may want to set up a basic system first before attempting to use the touchscreen.

:: Cortex Configuration File Setup  
In order to specify to Cortex that the touchscreen will be used, the following line must be included in the CORTEX.CFG file:

TOUCH_SCREEN < int ms_per_tik > [< store_touch_data >] [< invert_y_data >]

For example, the line could be:

TOUCH_SCREEN 50

where 50 is the number of milliseconds between queries of the touchscreen

(To emulate the touch screen using the mouse, use a negative number for the ms_per_tik value.) Since the calculation of the location of the touch is based upon the "pixels-per-dva" setting in the CORTEX.CFG file, it is imperative that the values are set correctly in the GRAPHICS_SPECS line. (In my test setup with a 17" Microtouch Model 8705 Mitsubishi 17HX monitor, I used the following settings: GRAPHICS_SPECS 640 480 60 20 20 8 NEVER.)

In Cortex version 5.9.3 and higher, the optional parameter, < store_touch_data >, was added to the TOUCH_SCREEN parameter of CORTEX.CFG. This parameter allows the user to specify whether or not the touch values should be stored to the EPPbuf, the CODE/ISI buf, both places, or neither place.

Valid values are:   EPPBUF   CODEBUF   NEITHER   BOTH (default) If no value is provided, the touch data will be stored to both the EPPbuf and CODE/ISI buf.

In Cortex version 5.9.4 and higher, the optional parameter, < invert_y_data >, was added to the TOUCH_SCREEN line of CORTEX.CFG. This parameter allows the user to specify whether or not the Y value from the touchscreen should be inverted.

Valid values are:   INVERT_Y   NO_INVERT

If the user does not specify this parameter, the default behavior is to *not* invert the y. Note: This change has only been implemented for the touchscreen with the two-computer version of Cortex. For the other versions of Cortex, this parameter is not used. Additionally, the inversion of the y data will not occur for the simulation of the touchscreen using the mouse. To avoid warning messages at the startup of Cortex, if the invert_y parameter is specified in the cortex.cfg file, then the store_touch_data parameter should be specified as well.

:: Using the Touchscreen with Cortex Timing Files  
(from the Cortex history.txt file)

Several external variables have been added to the state system to manipulate the touchscreen information. They include TOUCH_x and TOUCH_y (which are in units of 100 * dva, stored as integers), TOUCH_code (a character indicating error or repetition touches), and TOUCH_occurred (an integers indicating whether or not the TOUCH_x and TOUCH_y values are currently valid). At the desired rate (e.g. 20 Hz), CORTEX checks for touches on the touch screen. Then, the state system can poll the TOUCH_??? variables to assess touch-related conditions.

The TOUCH_x and TOUCH_y data are stored in the EPP buffer at the rate specified by the Params:General:EPP_storage_rate, provided that put_epp_data_in_buf(ON) was called from the state system first.

The CSS function touch_item(test,rel_pos,radius) returns -1 if no touch occurred, 0 if screen was being touched, but not within required radius, and 1 if screen being touched within required radius.

Refer to the timing file in the \cortex\demos\touch3 directory for an example.


NIMH CORTEX was written by a team of dedicated researchers for the NIMH Laboratory of Neuropsychology.
Questions or problems regarding this web site should be directed to CortexSite@salk.edu.