pythonbinarypsychopyparallel-port

Binary representation and setting parallel port data in PsychoPy


I've recently started learning how to use PsychoPy, the psychopy.parallel module, and binary representation. I hope someone can let me know whether I'm understanding things correctly.

On PsychoPy's website, it says these two functions set pins 2 and 3 to high:

parallel.setData(3)

parallel.setData(int("00000011",2))

I'm assuming these two functions set specifically pins 2 and 3 to high because the right-most 1 in parallel.setData(int("00000011",2)) refers to pin 2, and the 1 on the left to that refers to pin 3. If I'm correct, are the following correct?

To set pins 2, 3, 4, 5, and 8 high, I should use either of these:

parallel.setData(79)

parallel.setData(int("01001111",2))

Also, how do people usually decide which combination of pins to set high/low when programming an experiment (I'm trying to send two or more triggers during an EEG experiment in PsychoPy)? Or is it entirely up to me, as long as I know which combination of pins set to high/low is associated with which particular experimental event?

I really appreciate any help anyone can provide. Thanks a lot!


Solution

  • Your interpretation seems correct.

    The choice of pins to set is really determined by your EEG system and its signalling protocol, or whatever you will be doing at the analysis software stage to extract meaning from those triggers. PsychoPy doesn't know or care about the value of the pins: that stuff is entirely up to you to determine correctly to meet the external requirements.

    Note that you might also need to control the duration of the pulses: again, that will be determined by the EEG hardware.