Table of Contents

Acquiring Digital Codes

It is critical that we acquire time-locked digital codes upon presentation of each stimulus. These codes are used to bin the data according to stimulus type during analysis. This is also essential for creating event-related averages of the psychophysiological data (e.g. creating ERPs from EEG data) as it gives us the precise onset time of each stimulus. Below is a description of the hardware, software, and steps necessary for sending and acquiring such codes using the Biopac MP150.

Hardware

  1. USB from stimulus presentation computer
  2. 8-bit digital output from I/O lines FIO0-FIO7.
    1. A separate wire connects each line to the breakout board.
  3. Wires are connected to screw terminals on the breakout board. Each terminal is connected to a single pin of the male/female DB-25 connectors.
    1. FIO0-FIO7 should be wired to terminals 2-9 of the breakout board.
    2. The ground should be wired to terminal 18 of the breakout board.
  4. A 25-pin ribbon cable connects the breakout board to the MP150

Software

Sending

The LabJack U3 can be controlled via several different programs and languages. We use the LabJack Python module to send codes via PsychoPy.

The computer (Mac) should have Xcode (including the Command Line Tools) installed. The libusb package should also be installed (see here for details). Finally, the LabJack exodriver and LabJack Python module should be installed.

Below is sample code for sending digital codes. Additional details can be found here and here.

# import LabJack module
import u3
#NOTE: if running from PsychoPy you should use "from labjack import u3"
 
# Initialize some stuff
d = u3.U3()
d.getCalibrationData
d.debug = True
 
# Set all FIO bits to digital output and set to low (i.e. “0")
# The list in square brackets represent what’s desired for the FIO, EIO, CIO ports. We will only change the FIO port's state.
d.getFeedback(u3.PortStateWrite(State = [0, 0, 0]))
 
# To send a code, replace the first number in the list with a value between 0-255
# For instance, the following code would send a value of 15 by setting the first 4 bits to “1"
d.getFeedback(u3.PortStateWrite(State = [15, 0, 0]))

Acquiring

1. In the AcqKnowledge acquisition software, select MP150Set Up Channels.

2. Select Digital.

3. Check the Acquire box next to channels 8-15. The Plot and Value boxes can remain unchecked.

  • Pins 2-9 on the DB25 map to digital inputs 8-15 on the MP150

The MP150 does not read the 8-bit code. Rather, it is simply acquiring 8 separate channels of digital input. We need to create an additional channel that will take the result of an expression (that we define) as input. The expression will convert the 8 binary channels to a single decimal stimulus code.

4. Select Calculation.

5. Check the boxes for Acquire, Plot, and Value.

6. From the “preset” dropdown menu select Expression.

7. Select Setup

8. Enter the following formula: (D8*1 + D9*2 + D10*4 +D11*8 + D12*16 + D13*32 + D14*64 + D15*128) / 5
(note: we divide by 5 because the input is read as 5 volts. So a digital code of 255 would be summed to 1275.)