On 20 Nov, 2012, at 09:21, David McFarlane <
mcfa...@msu.edu> wrote:
> Um, once again stepping in where I probably don't belong... But are you really trying to use Parallel Python to control the parallel port using Python? I Googled "Parallel Python", and that got me to a project page (
http://www.parallelpython.com/ ) about providing a "mechanism for parallel execution of python code on SMP (systems with multiple processors or cores) and clusters (computers connected via network)." That seems like an entirely different kettle of fish to me.
Yes, I think you are after another package. Here is a suggestion from previous e-mails, for a package that may or may not have been incorporated in PsychoPy in the meantime:
> Looks like this warrants some attention at my end.
>
> The package that Mike points to is provides complete source code (although without an explicit license) and doesn't need any fancy install process (unlike most kernel-level drivers) so it looks like this solution can be delivered fully contained within Standalone windows dist. :-) Should be easy to make psychopy.parallel calls use the inpuot32 lib as Mike shows below.
>
> And if I switch from winioport to pyparallel, it looks like we can add linux support for parallel ports too.
>
> I'll see what I can do.
>
> Jon
On 29/08/2011 22:44, Michael MacAskill wrote:
> Hi Martin,
>
> I recently wrote an experiment using psychopy.parallel to control a Polhemus Liberty electromagnetic movement tracker but wasn't able to test it before departing overseas as we still needed to have a cable fabricated. Anyway, in my absence, testing showed that psychopy.parallel didn't work for us and they switched to another method (successfully). Anyway, that preamble is to indicate that as I didn't implement it, I'm working backwards from the code so may not be giving you the right steer. But:
>
> <
http://blog.wensheng.com/2008/10/python-parallel-port-on-windows.html> gives instructions for an alternative dll to download (inpout32.dll) and install. This may still be your limiting step though: no guarantees that McAfee won't get in the way again. We followed this route because psychopy.parallel wasn't giving us any joy, not because of virus warnings.
> More on inpout32 itself here:
> <
http://logix4u.net/Legacy_Ports/Parallel_Port/Inpout32.dll_for_Windows_98/2000/NT/XP.html>
>
>
> Our code:
>
> try:
> from ctypes import windll
> p = windll.inpout32
> p.Out32(0xbd00,0)
> except:
> print "Could not import parallel library. Parallel port functionality disabled, so can't sync with Liberty"
> parallel_module_present = False
> else:
> parallel_module_present = True
>
>
> # amend as required to read from rather than write to the port. Use p.Inp32() ?
> def sendParallelTrigger():
> # on Windows, send a pulse to the Liberty software to indicate the onset of the first stimulus for synchronisation purposes.
> if (parallel_module_present):
> p.Out32(0xbd00, 255) # put all low on port 2-9
> core.wait(0.005) # 5 ms pulse duration
> p.Out32(0xbd00, 0) # Set all high
>
But anyway, I wonder if mucking about with parallel ports is really what you want to do. Wouldn't using the networking code as posted in your initial message be a much cleaner way to go? Networking comms tend to be much easier and more reliable than mucking about with hardware ports.
i.e. in your setup, your presentation PC (running PsychoPy) sends TCP messages (including events and timestamps) to the specified port on your Mac (running NetStation, and which is physically connected to the EEG via Firewire). i.e. it doesn't seem that the PsychoPy computer would need to have a direct connection to the EEG machine itself, as your event markers can get directly embedded into the NetStation recording data?
Regards,
Michael