Response Boxes

Interface

MRA fMRI Console

A MRA Inc. fMRI Console is installed at both 3T scanners, the 7T scanner and the MR Simulator. It has a Cedrus RB830 board inside for processing response button presses. This board connects to the paradigm computer through a USB connector on the back of the fMRI console. A Windows driver is installed on the paradigm computer for the USB device and to map the USB to a COM port. The RB drivers for Windows and Mac OSX are on the Cedrus website. For Windows, follow the download link for "Pads Shipped After June 2011".

The response box appears as COM4 on our control room paradigm computers. On a laptop it will generally be the next free COM number. Framing should be set to 8 bits, 1 stop, no parity. The baud rate is 19200 except when SuperLab XID mode is selected and then it is 115200. On a Mac laptop, the response box will be a device named /dev/tty.usbserial-FT<nnnn>, where <nnnn> is a number based on the individual Cedrus box's serial number.

The fMRI Console has 2 toggle switches that allow selection of E-Prime (up-down), Presentation (down-up), Superlab 1.7 (up-up) or Superlab 4.0 XID (down-down) mode. Set both switches for the desired protocol, then press the Reset switch briefly. The green "Driver Loaded" LED should light up if the box is communicating with the computer.

Button Codes

SuperLab 1.7 (RB Series) Protocol

In this mode, the button box generates a single character for ANY change in button state - both button presses and button releases generate a character. The buttons are assigned to the 6 low order bits of the character (bits 0-5). A bit is set (1) when a button is not pressed and clears (0) when a button pressed. Bit 7 is always zero, bit 6 is always 1. The simple coding for single button presses is as follows:

button
pressed
bit
cleared
character value
binary octal decimal hex char (in Hyperterminal)
none none
01111111
0177
127
0x7F
DEL (Δ)
1 1 01111110 0176 126
0x7E ~
2 2
01111101 0175 125
0x7D }
3 3
01111011 0173 123
0x7B {
4 4
01110111 0167 119
0x77 w
5 5
01101111 0157 111
0x6F o
6 trigger
6
01011111 0137 95
0x5F _

Of course many other patterns are possible, if the subject is pressing more than one button simultaneously. For example if both buttons 1 and 2 were pressed the pattern would be: 01111100 = 1748 = 12410 = 0x7C16 = | (the vertical bar character)

So you can see patterns like this:
Operation
binary
octal
decimal
hex
char
press button 1 01111110
0176 126
0x7E
~
release button 1 01111111
0177 127
0x7F
DEL (Δ)
press button 3
01111011
0173 123
0x7B
{
press button 1
01111010
0172 122
0x7A
z
release button 3
01111110
0176 126
0x7E
~
release button 1 01111111
0177 127
0x7F
DEL (Δ)

In programmed scripts, it's best to use bit tests to determine if any button has been pressed. For example in Matlab use the bitget function to test if a specific button was pressed:

                if bitget (uint8(value), 4) = 0
                  <button 4 is pressed>
                end

Recall that the bit is set (1) if it's released, and clear (0) if it's pressed. Also, note that Matlab numbers bits from 1, whereas programming convention numbers from 0, as shown in the tables above.
See also the support page at the Cedrus website: http://www.cedrus.com/support/rb_series

E-Prime Protocol

In E-Prime mode, the response box sends a continuous stream of characters at 800 characters per second. The bits of each character indicate the current state of the buttons. If multiple buttons are pushed, the bit for each button will be set to one. Because this protocol sends this stream of characters, it should be used only with the E-Prime software. In the E-Prime Device Properties page you can indicate whether Presses only, Releases only or Presses and Releases should be returned to your paradigm script.

button
pressed
bit
set
character value
binary octal decimal hex char
In Hyperterminal
none none
00000000
000
0
0x00
null
nothing
1 1 00000001 001 1
0x01 ^A
open smiley face
2 2
00000010 002 2
0x02 ^B
filled smiley face
3 3
00000100 004 4
0x04 ^D
4 4
00001000 010 8
0x08 ^H
backspace
5
5
00010000 020 16
0x10 ^P
filled right arrow
6 (trigger)
6
00100000 040 32
0x20 space
space

Presentation or ASCII Protocol

In Presentation mode, also called ASCII mode, the response box sends a single character each time a button is pressed. No character is sent on button release. There is no way to tell if 2 buttons are held down at the same time - you will never get any response other than the 6 shown below. This makes it the easiest mode to read in user developed software and should be used for Neurobehavioral Systems Presentation which is installed on all paradigm computers.

button
pressed
character value
binary octal decimal hex char
1 00110001 061 49
0x31 1
2 00110010 062 50
0x32 2
3 00110011 063 51
0x33 3
4 00110100 064 52
0x34 4
5 00110101 065 53
0x35 5
6 (trigger) 00110110 066 54
0x36 6

SuperLab 4.0 or XID Protocol

XID stands for eXperimental Interface Device. With this mode, the button box can be used to time experiment events rather than relying on the timers in the computer. When a button is pressed a 6 character response is send through the serial port. The first character is always "k". The second character is divided into the following: Bits 0-3 indicate the port number, in our case always 0. Bit 4 is 1 if a button was pressed, 0 if released. Bits 5,6,7 indicate which button was pressed. The final 4 characters give the time of the press or release since the Reaction Timer was last reset in milliseconds. The 4 bytes represent a 32 bit integer. The Reaction Timer is reset to zero when the Cedrus in plugged in to the USB or when the Reset switch is pressed on the console. It can also be reset to zero by sending a command (e5) from the computer through the serial port. This would typically be done at the time a stimulus event occurs.

The use of time stamped button responses means that your application does not have to check the serial port so often to get accurate response timing. There are a number of other XID commands that can be send to the response box in this mode.
See http://www.cedrus.com/xid/ for details.
Example Matlab script using XID mode written here.