MATLAB AND PTB WITH THE FORP
Users of our USB devices have reported problems to us with MATLAB and Psychophysics Toolbox. This page is intended to explain the issue and how to work around it.
STANDARD USB KEYBOARD BEHAVIOR (OR "NON AUTO-RELEASE" OR "NAR" BEHAVIOR)
Standard keyboards assert key presses for as long as that key is held down by the user. This is essential to support, for example, the auto-repeating of keys that users expect in programs like word processors.
At the lower USB level what this means is that the keycode is repeatedly sent until the key is released by the user.
Many research users run into problems with this standard keyboard behavior-- they would like to know when a button is pressed, but not how long it is held down. And they may run into problems with repeating keys interacting badly with their scripts.
For those users, we provide an "auto-release" behavior: The keycode for a particular button is sent when the button is pressed, but is not sent again until the button is released and pressed again. To the host computer this makes it look as though the button was released immediately even though it may be still held down physically.
Most programs work correctly with auto-released keys so, for example, if you test the output from our devices using Word, or Notepad, or most psychometric programs, you will never miss a keypress. MATLAB/PTB however, does not reliably receive every auto-released button press
HOW TO WORK AROUND IT
The solution is simple: If you are using MATLAB/PTB you should select an "NAR" operating mode. In the NAR modes the button presses are asserted long enough for MATLAB/PTB to reliably receive them.
We support NAR modes on all of our devices. On the FIU-004/5 interfaces, this mode is selected by using switch position 2. On the 932 interface, there are several NAR modes (HID NAR BYGRT, HID NAR 12345, etc.) to choose from. See 932 Use Modes for more information.
On the trainers, 904, and 905 devices we can provide NAR firmware to flash into the device.
Please contact us if you have any questions about how to set up your device for use with MATLAB/PTB.