Timing experiments need different types of input devices. The PXL programs currently support up to three different ways for response collection:
4.
|
Selection of one of these timing input devices is done by setting the experimental variable switchtype to a numerical code that describes the device. Table scode contains the currently valid code values. The default is switchtype 0 which enables keyboard input. Code values from 1 to 19 are reserved for switchboard devices. Values from 1 to 5 are reserved for switchboards connected to the game port connector. Values from 11 to 16 are used by switches connected to one of the parallel printer connectors.
|
5.
|
Thus switchtype timing has two functions: it tells Timing programs about the type of response device available, and it allows the user to select one device if several are available and the program is able to use different devices. Most programs are able to use any of the three devices possible. In these cases the variable switchtype may be used to tell the respective program which type of switch should be used. Note that the command line option may also be used to set the default input device. As described in other chapters, an assignment in a program's parameter file overrides the defaults. In some cases it is not sufficient to set the input device. It may also be necessary to tell a program the exact input codes in order to decide what are correct and false responses. An example is the program rtm. This gives the input codes for the switches of switch boards. The input codes for keyboard input are the corresponding ASCII values or the keyboard scan codes.
|
It must be clear, however, that not every timing program allows input from every arbitrary device. There may be programs that definitely require a certain device in order to work properly. Suppose you want to measure response times. Using the keyboard as a response device will be a bad idea in this case, since there will be a considerable delay between the subject's response and the software interrupt that is needed to detect it. Thus a program UTC to measure response time may require a switchboard. In this case the program will check the current value of switchtype before it starts. If the switchtype value is not appropriate, the program will issue a fatal error message and stop execution.
Each aviation computer timing board has a keyboard that may be used as a response device. For many experiments a keyboard is sufficient or even necessary.
One major problem with keyboard input is that the system's keyboard software usually is not very useful for running experiments. PXL provides some but not too much help for MS-DOS users. PXL programs intercept the keyboard interrupt service in order to get the interrupt time as early as possible and they provide a real BREAK key, that even works if the program runs in a dead loop not doing any system call.
Thus a PXL program may be stopped any time by pressing the CTRL-C key combination. Such a break closes all open files and restores the original system status. The break mechanism works on MS-DOS systems but only as long as the keyboard buffer is not filled by other nonsense input.
Timing switchboards on IBM PC/AT compatibles may be connected to the parallel printer port or the game port. The printer port provides 5 handshake input lines that may be used to connect up to 5 digital switches to the computer. Figure prswitch shows a simple passive network to connect 5 switches to the IBM PC parallel input connector. Figure gswitch shows how to connect 4 digital switches to the game port connector.
Note from Table scode that the timing switchtype codes for switches do not stand for the number of switches but for the configuration. Thus number 4 is a switchboard with four switches in a single row, while number 5 stand for 4 switches in a square. Figure sboard shows the suggested configurations for switch boards and the corresponding numbering schema.
Mouse devices may be convenient for experiments since they have simple buttons that make them saver than keyboards. However, they suffer from the same timing problems as keyboards. The PXL software automatically detects the number of buttons and uses the buttons in the same way as switchboards are used. Note that mouse usage requires that a mouse device driver is installed. Mouse drivers are able to generate interrupts and some PXL programs are able to use interrupt driven response keys. Usually these have to activated by a flag and are not used by default. In order to get stable timing with mouse buttons one has to make sure that no mouse movements occur while the programs is waiting for a response. Thus either the mouse is fixed or the mouse ball should be removed.
All response events are numbered. The switch numbering is bitwise and it is defined by the entries of the array switchnumbers. The default for switchnumbers depends on the device type. For game port switches the default is switchnumbers = [0, 0, 0, 0, 1, 2, 3, 4]
Note that bits 0 to 3 are not used with game port switches since the single switches are connected to bits 4 to 7 of the game input port. For printer port switches the default is.
Mouse event numbers are switchnumbers = [1, 2, 3] depending on the number of buttons available. The event numbers for keyboard input are identical to the key's scan code combined with the extended ASCII code for the respective key. The test program event.exe may be used to find out the event numbers of any response device.
Many experiments use yes/no responses. In this case the parameters yeskey, nokey, and stopkey offer a simple way to define which switch number corresponds to the respective response. Simply define the parameter value to be the switch number of the corresponding response event. The default values for these keys in case of keyboard input are ok.
Response switches usually have special patterns which are related to special meanings for experimental programs. An example is a program for adjusting some stimulus intensity. Such a program needs at least 3 keys: one for up, one for down, and one to indicate that the adjustment is finished. These keys are selected by binary patterns which are used to mask off certain bits of the input ports.
All the parameters for an input switch board are stored in the array switchmask. The list of definitions in Table swmask shows the meaning of the different entries of switchmask. The array switchmask may be redefined in parameter files. The following example defines the patterns for an 8-bit parallel input port at port address 0x104(= 260) with initialization port address at 0x107 (=263):
Note that the parameter switchtype is not affected by changing switchmask. In fact, the default values of switchmask are those belonging to the built in mask values for switchtype. One may change only selected entries of switchmask by inserting only those entries which have to be changed. All the entries which are not to be changed have to be set to -1.
Mouse devices may be convenient for experiments since they have simple buttons that make them saver than keyboards. However, they suffer from the same timing problems as keyboards. The PXL software automatically detects the number of buttons and uses the buttons in the same way as switchboards are used. Note that mouse usage requires that a mouse device driver is installed. Mouse drivers are able to generate interrupts and some PXL programs are able to use interrupt driven response keys. Usually these have to activated by a flag and are not used by default. In order to get stable timing with mouse buttons one has to make sure that no mouse movements occur while the programs is waiting for a response. Thus either the mouse is fixed or the mouse ball should be removed.
All response events are numbered. The switch numbering is bitwise and it is defined by the entries of the array switchnumbers. The default for switchnumbers depends on the device type. For game port switches the default is switchnumbers = [0, 0, 0, 0, 1, 2, 3, 4]
Note that bits 0 to 3 are not used with game port switches since the single switches are connected to bits 4 to 7 of the game input port. For printer port switches the default is.
Mouse event numbers are switchnumbers = [1, 2, 3] depending on the number of buttons available. The event numbers for keyboard input are identical to the key's scan code combined with the extended ASCII code for the respective key. The test program event.exe may be used to find out the event numbers of any response device.
Many experiments use yes/no responses. In this case the parameters yeskey, nokey, and stopkey offer a simple way to define which switch number corresponds to the respective response. Simply define the parameter value to be the switch number of the corresponding response event. The default values for these keys in case of keyboard input are ok.
The PXL programs use milliseconds as their unit for timing parameters. The time is derived from the hardware and software timer available in IBM PC/AT computers. Precision of timing is around 1 millisecond on these systems. The IBM PC timing software is extremely hardware dependent and works only on true “compatibles”. The system time on these machines is derived from a hardware counter whose input frequency is 1.19318 MHz. This frequency is constant across all IBM PC compatible computers and independent of system bus timing and of processor clock speed. The PXL timing software is optimized for speed by using only integer arithmetic.
No hardware floating point processor is used by the timing functions. One consequence of this is that timing is not correct across midnight. Thus it is better not to run experiments that try to measure the time between two events such that the system time crosses midnight in between the two events. If this seems to be an absolute necessity for someone, a simple solution is to use a wrong time of day value. Simply set the time of day such that the midnight overflow does not happen during the experimental run. Section ttcheck describes the test program ttcheck which may be used to test the proper working of PXL's basic timing functions.