Does anyone know how I can send ASL eye tracker event triggers using Psychopy?
It’s been a while since I heard the name ASL.
If I recall correctly, most of their systems had TTL input that is compatible with a standard computer’s parallel port, so you could use that. If your computer does not have a built-in parallel port, you might want to consider Cedrus’ c-pod products.
I strongly caution against using USB-parallel port converters due to poor timing in their USB drivers.
Thank you for your response. I greatly appreciate it. Yes this is very old technology. I have been told that our facility will buy a new eye tracker soon. But that will be in a couple of months, so I’m stuck with this for now.
Regarding TTL and parallel port, I checked the MATLAB code they used for other experiments and that seems to be the case.
What I fail to understand is how these parallel ports work to begin with. For example, I have the address of the port etc. And what they seem to do in MATLAB is this (there are a few functions they are using, but it boils down to this code below)
The byte part they are using an arbitrary number such as 1 or 3 to signal whether it is offset or onset.
But when I compare this to PsychoPy documentation I see that some numbers represent specific pins but they may also affect all pins (such as 255) but 3 will set 2 and 3 to high. It also says it is possible to set specific pin values? I am not sure what values need to be set to simply signal trial onset, offset etc.
It explains it here but I’m not sure what values are the best to use for this purpose.
And as far as I gather from the internet the code needs to wait before resetting pins so that the values can go through. But I don’t see other people in the facility doing this. At least when they showed me their code I didnt see such thing.
I am very new to PsychoPy but I am very experienced with real-time I/O on Windows using MATLAB. In fact, I wrote the io64.mex64 utility that you mentioned in your post. In addition, I am familiar with ASL (R.I.P.) eyetrackers with the 25-pin XDAT port used for triggering the ASL software.
If you send me your MATLAB code fragment I will see if I can figure out what they were doing in their previous experiments with the eye tracker.
I can try to clarify some of your confusion.
A parallel port has 25 pins, and 8 of these pins are called data pins. These are pins that can be set to either 0 (low) or 1 (high). On a parallel port, the data pins are specifically pins 2-9. You can choose a certain pattern of 0s and 1s to represent a certain event (e.g., trial onset). The collection of 8 bits is also known as a byte (1 byte = 8 bits). However, you can also convert the byte into a decimal value (see here). So then, the following values are equivalent:
|Decimal calculation||0||0||0||0||0||0||0||2 (2^1)||1 (2^0)||2+1 = 3|
As @FrankS probably already explained to you, the utility he wrote sets pins 2-9 to a byte value (i.e., a pattern of 0s and 1s across 8 bits). Giving a value of 3 translates to setting pins 2 and 3 high. Similarly, in the PsychoPy parallel package, using the
setData() function will set pins 2-3 to 1 and keep all others 0, until you set all pins back to 0.
setData() is probably what you need, the parallel package allows you to set specific data pins to 0 or 1, if you wanted. So the following are equivalent:
- Setting the whole byte at once:
- Setting the two pins specifically with
port.setPin(pin_number, 0 or 1):
And two last things on the logistics of sending the trigger using PsychoPy:
- You can choose whatever byte you want
- See this post for how to send the trigger and set the duration
Hope that helps!
Thank you so much for your elaborate reply. I asked an electronics engineer in our facility so with his help I figured it out. So my experiment is ready.
What I gather from your elaborate answer is that setData() function sends the value that I intend to send, for example if I want to send 3. It uses pins 1-2 to generate 3 (each pin generates a different value, but their addition ends up 3). So it combines specific pins to send a single value, right?
@FrankS thank you for reply and your kind offer! Thankfully I figured out how to use it so I won’t need to bother you about it.