简体   繁体   中英

PsychoPy: send triggers over parallel port of PC with XP 32 bit

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?

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, ie, something like <psychopy.parallel.ParallelPort object at 0xe4805b0> . In that case, you would need to fix access to the drivers somehow.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM