Mario Reutter Mario Reutter - 11 months ago 124
Python Question

PsychoPy sending triggers on 64bit OS

I have a problem with sending triggers for eeg recording using PsychoPy standalone v1.81.00 on a Win7 64bit OS. I followed the descriptions here and don't get any (more) errors. The triggers, however, don't show on the recording computer (Brainvision Recorder under Win7 32bit).

What I did:

  1. Downloaded and installed the InpOutBinaries_1500 via InpOutBinaries_1500\Win32\InstallDriver.exe

  2. Copied the other files (inpout32.dll, .h and .lib as well as vssver2.scc) to the working directory of my script

  3. Tried sending trigger codes with
    windll.inpout32.Out32(0x378, triggerCode)

The trigger code doesn't show up in Brainvision Recorder but seems to be set correctly when calling
print str(windll.inpout32.Inp32(0x378))

Thanks for every piece of advice or idea!

Answer Source

I managed to solve the problem. I'm not entirely sure which step(s) actually cut the curve but I recommend the following:

Download and install LPT Test Utility on your presentation computer.

At first, this program installs the inpout32.dll automatically and correctly regardless if you use a 32 or 64 bit OS. More over, it helps you to monitor and manipulate the pins of your parallel port. If using the standard addresses (LPT1 through LPT3) doesn't work, select LPTX and enter your address manually (see here where to get your parallel port address on a Windows PC). If the triggers don't show on your recording computer using this program, you have an issue that is not related to PsychoPy.

If this fails, (re-)install a parallel port driver. Using Windows 7 this should not be necessary but actually solved one major issue for me. If this still fails, probably the hardware components (parallel port plug / card, cable(s), sync box) are damaged.

If the triggers work with the "LPT Test Utility" program but not using PsychoPy, an individual troubleshooting dependent on your code is necessary. Of course, you need to insert the port address that worked with "LPT Test Utility" in your PsychoPy code.

from psychopy import core
from ctypes import windll

windll.inpout32.Out32(portaddress, triggerCode) #sends the trigger with triggerCode being an integer between 0 and 255
core.wait(0.05) #wait 50ms
windll.inpout32.Out32(portaddress, 0) #deletes the trigger i.e. resets the pins

Best wishes,