[open] TMS parallel port managing delays
Dear all,
I am running a visual behavioral experiment where subjects must make a size judgment one 2 elements presented on a picture (which one is larger) and then press left or right. Experiment works fine using psychopy back-end but now i want to add TMS on it.
In the experiment I present the picture during 200 ms. and I want to use 5 different delays (0-50-100-150-200 ms) in the TMS pulse. in order to "send" the pulse instruction to the TMS i just need to send a "1" pulse through the parallel port and then come back to "0" state.
So I have two problems at the moment:
1- On one side I can't use the parrallel_port plugin because the parallel port of the computer is an external card whose number is E010 ... what means it is the port number 57360 in decimal values, and this number in not covered by the port plugin. is there anyway to overcome this issue?
2- In the case I could use the plugin, is there any way to "tell" the plugging to "wait" for an x amount of time before sending the pulse?
I think that both problems could be solved using inline code , but looking in the forum I just found the posibility to use something like:
from ctypes import windll
port = 889
dev = windll.inpout32
val = dev.Inp32(port)
print "Read %d from port %d" % (val, port)
but when I tried OpensSesame launches an error saying that there is no module ctypes (I alreaddy installed inpout32.dll).
I am using OpenSesame is 2.9.7 Hesitant Heisenberg on a Windows 7 machine.
Any ideas? Recomendations?
Thanks in advance.
Felipe
Comments
Hi Felipe,
Let's begin with the
ctypes
issue. This module is part of the Python standard library, so it should always be available. What script did you try exactly, and what is the exact error message?Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
Thanks a lot for your fast answer...
So far I have the code line like this:
Using this code I get the following error message in the debug window:
Error while executing inline script
Could you help me here on what is wrong in the code in order to activate the parallel port? Is there any "easier" way to activate the port in between of the stimulus presentation?
Thanks again
Felipe
Hi Felipe,
It's a bit unclear where exactly this error message comes from. Could you upload the entire experiment script, for example to http://pastebin.com?
And are you running 32 bit or 64 bit Windows 7? It kind of looks like a compatibility issue, but I'm not sure.
I'm afraid not. The parallel port is very outdated, pretty much only still used by EEG researchers. It's always a bit of a problem to activate it under Windows. (But it can be done.)
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
Thanks for your answer.
There are two ways toa ccess the TMS serial or parallel port. The parallel seems to be much easier since you just need to sens a "1" to open the port and activate the tms pulse and a "0" to close it again.
Of course, as I tried to explain before, this is not really straight foward with OpenSesame when i need to use different time delays after a picture presentation.
I let you the code I have written here:
http://pastebin.com/JCxAD00X
I am running it on a Windows 7 Profesisonal 32 bits machine.
Thanks a lot for your help
Felipe
Hi there,
It seems that my pastebin link expired so I reupload in case somebody is interested to give me some help on this issue.
http://pastebin.com/AxDgLAqc
Thanks in advance for any idea or help to deal with this problem.
Felipe
Hi Felipe,
Could you clarify a bit what exactly you're trying to do? From your description it sounds like you want to send triggers via the parallel port, but in your script you're reading from the parallel port.
Then we have the
inpout32.dll
error, which is quite mysterious. Isinpout32.dll
actually present in the OpenSesame folder?As an alternative, you could use
dlportio.dll
instead, either through a script or theparallel_port_trigger
plugin? This is explained on this page:Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
Thanks for your reply.
You re totally right with the issue inpout32.dll ... I want to send a "1" and not to read the port.
I need to present a picture and send a "1" to the parallel port either 0-100-150-200 ms after the picture presentation, and inmediately after close the port. (The "1" triggers the TMS pulse) .
The pluggin does not work because the parallel port of the computer is an external card whose number is E010 ... what means it is the port number 57360 in decimal values, and this number in not covered by the port plugin. Is there anyway to overcome this issue? Solving this problem would be the easiest way.
Then , the inline code of dlportio.dll would be the only option. Still, the problem is how to delay 0-100-150-200 ms to send the trigger.
Any idea how to overcome this issue with the inline code?
Thanks again.
Felipe.
Hi Felipe, did you solve the problem? I am facing something smilar right now with the need to trigger TMS and a too large parallel port number. Thanks! Luigi
Hi Luigi,
Unfortunately I never found a solution . So I moved to another stimulus presentation software.
I hoipe you got better luck!
Cheers
F.
Hi Luigi,
Managed to get this working with port = 0xD010 by downloading the Binaries only from http://www.highrez.co.uk/downloads/inpout32
Unpacking the Win32 folder.
Running InstallDriver.exe as Admin
Copy the file inpout32.dll from Win32 to c:\Windows\SysWOW64\ and rename it to dlportio.dll
Best,
Jarik
I tested this on Windows 7 64 bit with OpenSesame 3.0.7 using inline script: http://osdoc.cogsci.nl/devices/triggers/#using-dportiodll-in-a-python-inline-script-windows-only
with port = 0xD010 instead of port = 0x378
I used a StartTech PEX1PLP (PCI Express Parallel port card)