1

I need to send some data via parallel port using Python. And for this I am using psychopy.parallel module.

I have two Windows 7 x64 machines connected via parallel port. This connection is tested and working because it is used by another software to send data via LPT1 port.

I have installed the necessary libraries for psychopy.parallel as described here.

Here is my naive intuition:

Machine 1 (Sending data):

from psychopy import parallel
port = parallel.ParallelPort(address="0xC010")
port.setData(3) # sets just pin 2, 3 high

Checking on Machine 1

port.readData()
> 3

Checking on Machine 2 (Receiving data):

from psychopy import prallel
port = parallel.ParallelPort(address="0xEC00")
port.readData()
> 0 

I see that although I can set the pins correctly on Machine 1 and read the result, Machine 2 just gives me a 0.

  • How to send and receive a signal via parallel port correctly?
minerals
  • 6,090
  • 17
  • 62
  • 107
  • 1
    Just as an alternative, any reason you can't just use TCP/IP? – Wayne Werner Jun 24 '16 at 14:30
  • What is received if you send `255`? – handle Jun 24 '16 at 14:36
  • Also try https://github.com/pyserial/pyparallel – handle Jun 24 '16 at 14:38
  • 1. Unfortunately I have to use parallel port for LPT1 debugging. 2. If I send 255, the output of `port.readData()` does not change, it is still `255`. 3. **pyparallel** does not work on Windows x64 – minerals Jun 24 '16 at 15:51
  • 1
    @handle The psychopy.parallel package is essentially pyparallel but with a couple of additional convenience functions – Jon Jun 27 '16 at 09:44
  • @minerals I believe other users have been successful in using parallel ports on win64 machines while using the 32bit python binary (which is most likely what this person is attempting) – Jon Jun 27 '16 at 09:44

1 Answers1

1

There are a few options:

  • Maybe you haven't got the right driver for pyparallel/psychopy to talk to. You'll need a 32bit parallel port driver if you're using the Standalone PsychoPy (which includes 32bit python). The answer in the link below tells you how to download another test utility that will insert the correct version of both 32bit and 64bit drivers, which you need to do on both machines obviously
  • your script sending the pules will finish immediately and conceivably the pins are all being set back to low when the script ends? (I think this isn't usually the case but worth checking)
  • have you set the right address for the parallel port? Your code currently uses the default address but there are various options.
  • Lastly, the link below tells you how to do it using inpout32.dll directly but I think the drivers are the first thing to get fixed

PsychoPy sending triggers on 64bit OS

Community
  • 1
  • 1
Jon
  • 1,198
  • 7
  • 8