Inconsistent parallel port sending

Hi there,
I’m writing the code for an EEG experiment. Everything looks to be okay so far, but I have a strange problem with sending a parallel port signal. In my experimental block there are 64 stimulus presentations, however the EEG computer is successfully receiving only about 55 of them. The problem seemed to improve when I got rid of using win.callOnFlip(), making me think that dropped frames may have been the problem, however there are always seems to be some non-received signals. I’ve also tried to get the signal to send for longer than a single frame. Here is my example code for a typical stimulus presentation:

if p_port_stim.status == NOT_STARTED:
p_port_stim.frameNstart = frame_n
p_port_stim.status = STARTED
p_port_stim.setData(int(10))

            if p_port_stim.status == STARTED:
                if p_port_stim.frameNstart == (frame_n - 5): 
                    p_port_stim.status = NOT_STARTED
                    p_port_stim.setData(int(0))

I’m fairly new to Psychopy, so apologies if I’ve done anything silly!