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.
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]))
1. In the AcqKnowledge acquisition software, select MP150 ⇒ Set Up Channels.
2. Select Digital.
3. Check the Acquire box next to channels 8-15. The Plot and Value boxes can remain unchecked.
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.)