Using psychopy with a parallel port card

Hi all,

I am wanting to use Psychopy to run an experiment in which it sends a signal to a tms machine. Since new computers don’t have parallel ports, I have attached a parallel port card to the computer and connected the tms machine to this.

However, I am struggling to get the tms machine to fire. Both the demo parallel port code and my code run without error, but the tms machine does not fire.
I was wondering whether anyone has previously used psychopy with a parallel port card? And if so, how did you get it to work?

When I look in device managers at the address of the parallel port it says EFF4-EFF7 and EFF8-EFFF. Therefore would I use 0xEFF4 in my code as the port address?

Any help on this would be greatly appreciated! I’m not sure whether the problem is due to me not having the correct port address, my code to trigger the machine is wrong, or that psychopy isn’t compatible with the parallel port card.

I’ve spent hours looking online but cannot find a suitable answer, and I’m stuck as to where I can get help now.

Thanks,
Emma

1 Like

There are several posts about it in this website, and most of the time with Windows it has been quickly solved by adding the driver file to the same folder as your script. See my answer here which has a link to an answer on the old psychopy page that has the file I’m talking about (input32.dll).

1 Like

Hi Daniel,

Thank you very much for your reply. Unfortunately this is not the problem. I have already done this as the script doesn’t run without it. I’ve read all possible posts on here but none of the solutions have seemed to help!

Thanks,
Emma

Hello,

There is also a 64-bit version of the driver. I haven’t used a parallel port in years but I remember having to install inpoutx64.dll to make work.

1 Like

Thanks everyone for your help. I had just copied the inpout32 files into the folder without installing the driver, which is why it didn’t work!

Glad that the problem is solved. On a more general note, a very helpful tool for troubleshooting of parallel port issues is the LPT Port Test Utility

Hi Emma,

Thanks for sharing your process here! I am actually experiencing the same problem right now - trying to get PsychoPy to send a trigger to an electric stimulus apparatus through parallel port, and we are using a parallel port card on a Windows 7 computer. We also have the inpout32 files in the same folder, but I’ve never heard about having to install anything - if you can tell me how you did this that would be highly appreciated. Also I wanted to know what you ended up using as your port address?

Thanks so much, we are really out of options since no one in our department seems to be able to help…

Best,
Sky

Hi Sky,

This was a while ago so I cannot remember exactly what I did, but once I had copied the files in the right folder, I clicked on one of them and it installed it - so I’d just advise trying to open the files and hopefully that will work.

For the parallel port number, it was 0xEFF8, so what it said in the windows settings. Someone created a quick script for me that ran through all the parallel port numbers, which is how I found it. I could send it to you if you think it would be helpful?

I hope that you manage to get it to work soon… I know how frustrating it can be!
Emma

1 Like

Hi Emma,

Thanks so much for taking the time to respond!

So if I understand correctly, you didn’t have to run anything in command prompt or anything, just clicked on the files and they automatically installed?

It would be really helpful if you could send whatever info would be convenient for you about your port numbers! So if the number on our computer is E010, the port number in the code should be 0xE010?

Thank you so much!

Best,

Sky

Hi Sky,

Sorry for the slow reply. Yes I didn’t do anything in the command prompt, it just installed. Have you managed to get it to work?

Here is the script that runs through the parallel port numbers and sends the signal at the correct one. Yes I think yours would be 0xE010:

from psychopy import visual, core, event, monitors, gui, logging, parallel, data
import psychopy.info

possadd = (0xEFF8, 0xEFFF, 0xEFF4, 0xEFF7)
possadd_str= ("0xEFF8", "0xEFFF", "0xEFF4", "0xEFF7")
triggers = range(1,100)
window = visual.Window(fullscr=False, units='cm', color = (0,0,0), size = (800,600)) #Background color

for address in range(len(possadd)):
    port = parallel.ParallelPort(address=possadd[address])
    for trig in triggers:
        print(possadd[address])
        print(trig)
        

        text = "firing at " + str(possadd_str[address]) + " " + str(trig)
        def DrawCenteredText(text):
            toshow = visual.TextStim(window, text= text, units='pixels', autoLog = False, color=(200,200,200))
            toshow.draw()

        port.setData(1)
        DrawCenteredText(text)
        window.flip()
        core.wait(0.1)
        port.setData(0)

window.close()
quit()

Good luck,
Emma

1 Like

Hi Emma,
I met a similar problem, and check my problem again and again. However, It hasn’t worked. the link is as follew:

I hope you can try to answer my question. Thank you very much.

Best wishes,
Chenglin

Hi Emma,

Thank you very much for the code. What will show up for a port that works and for a port which doesn’t work?

Thank you very much :slight_smile: