psychopy.org | Reference | Downloads | Github

Parallel port output multiplied by 4

#1

I am sending markers to a Brain Vision EEG recording system from python psychopy.
All the received markers are multiplied by 4 (shifted by 2 to the left), e.g. sending 1 00000001 is received by brain vision recorder as 4 00000100, and so on. I need to send around 70 different markers and this shift is limiting me to 63 markers.
Any thoughts on what might be causing this?

0 Likes

#2

Hi Tamer :slight_smile:

can you post all your code that relates to sending the triggers/markers?

Also, could this be due to settings in the BrainVision Recorder software? (That is, did it work previously and you recently made some changes there?)

0 Likes

#3

Hi Stefan, :slight_smile:
thank you for the reply.

Using this code produces the issue for me:

from psychopy import parallel
import time

port = parallel.ParallelPort()


def send_markers(markers):
    for trig in markers:
        port.setData(trig)
        time.sleep(0.010)  # wait for 10 [ms]


markers = range(24)
send_markers(markers)

In the brainvision recorder, the received markers are multiples of 4 of the passed list markers.

I believe it is, I will post a screenshot of the settings of the parallel port in the brainvision recorder soon.

0 Likes

#4

The code looks fine, given that your sampling frequency is > 100 Hz. One thing you could try is setting the Data to 0 after each trigger:

def send_markers(markers):
    port.setData(0)  # initial Data state at 0
    for trig in markers:
        port.setData(trig)
        time.sleep(0.010)  # wait for 10 [ms]
        port.setData(0)  # reset Data line to 0, ready for next trigger
0 Likes