3

I am having problems with sending triggers from a 32 bit PC with Windows XP Professional and Psychopy v.1.81.03 to the parallel port.

I am positive that the port address is 378, and am able to send triggers with Eprime and I am able to turn specific pins on and off with the software parmon (http://english.eazel.com/lv/group/view/kl35264/Parmon.htm)

I have tried using the experiment posted by Stéphanie and Nicholas (see this post in the psychopy google group: https://groups.google.com/forum/#!topic/psychopy-users/PxPhRDkuu2A)

I have verified that pywin32 (version 217) and parallel are installed, and tried both

port = parallel.ParallelPort(address=0x0378)
port = parallel.PParallelInpOut32(address=0x0378)

When using ParallelPort, I get:

Traceback (most recent call last):

File “ D:\SebastianKorb\untitled2_lastrun.py”, line 65, in

port = parallel.ParallelPort(address=0x0378) AttributeError: ‘module’

object has no attribute ‘ParallelPort’

Line 65 is where the command port = parallel.ParallelPort(address=0x0378) is executed (note though that before that there is the line from psychopy import parallel)

When using PParallelInpOut32 I get the same (only now the error is about ‘PParallelInpOut32’)

I also tried to run the few lines of code shown on the psychopy reference manual (http://www.psychopy.org/api/parallel.html):

from psychopy import parallel 
port = parallel.ParallelPort(address=0x0378) 
port.setData(4) 
port.readPin(2) 
port.setPin(2, 1)

But again, I get the same type of error.

I should mention that I have also verified that I have administrator access to the file C:\Windows\system32\drivers\parport.sys

Can you please advise me on what I should try next?

Community
  • 1
  • 1

2 Answers2

5

I overlooked that it's actually the other way around. The direct calls to the parallel-port functions (as below) are deprecated. Nevertheless, they should still work. So maybe give it a try:

from psychopy import parallel
parallel.setPortAddress(0x378) #address for parallel port on many machines
parallel.setData(0) #sets all pins low
parallel.setPin(2,1) # set a certain pin high
parallel.setData(0) #sets all pins low

You should leave the pin high for a while or leave out the last line. Otherwise, you won't be able to detect the change. That's also how it is done in the Coder hardware demo "parallelPortOutput.py". Maybe try this first.

Best,

Axel

Addition: Sebastian, my hunch at the moment is that the port does not even get initiated. I think the problem at the moment is that the respective error messages are only logged, but no informative error message is thrown (check the log files). That means that actually somehow the port drivers cannot be accessed on your system for some reason. In the Coder Shell type from psychopy import parallel and then do next port = parallel.ParallelPort() (no address). Now just type port and paste the output here. My guess is that you only get the base class (ParallelPort) with which you cannot do anything, i.e., something like <psychopy.parallel.ParallelPort object at 0xe4805b0>. In that case, you would need to fix access to the drivers somehow.

Axel Kohler
  • 131
  • 4
  • 2
    You should probably have a duration between ``parallel`` calls, e.g. a ``core.wait`` or a stimulus presentation with ``visual.Window.flip()``. Otherwise the interval may be too short for the voltage to actually change on the port. – Jonas Lindeløv Feb 18 '15 at 13:09
  • thanks, but using what Axel suggested and adding a core.wait(1) inbetween turning on and off the pins resulted in the error 'Port address must be set using setPortAddress', due to the fact that __init__.py line 151 actually wants the port address to be saved the other way (with PORT = parallel.ParallelPort(address=0x0378) ). other ideas – Sebastian Korb Feb 18 '15 at 15:44
  • after reinstalling the drivers, it now works fine. Thanks so much!! – Sebastian Korb Feb 23 '15 at 12:56
1

I'm gong to back Axel's "hunch" here. I think it's extremely likely that either you don't have a parallel port driver installed or it isn't working. Try installing the InpOut32 driver from here, restart your computer and see if that fixes it:

http://www.highrez.co.uk/Downloads/InpOut32/

cheers, Jon

Jon
  • 1,198
  • 7
  • 8