Output Triggers Before it is Asked For

I have a system which is sending a digital output to an inkjet printer to draw a line on a product. The program runs using cases for each line as the position changes each time. Each case calls a subroutine to trigger the printer and draw the line. Most of the time it works fine, but sometimes, at the end of a line, instead of moving to the start position of the new line and then printing, the printer is triggered as its moving into position. It then does not print when it starts the new line.

Any help would be appreciated.

Is it possible to add a wait after the move, but before the print output ?

Yes I have now put wait commands in so hopefully this will resolve the issue.

iirc, program execution actually reads a few lines ahead. I have experienced the same.

you could try a sync() script line instead of wait. sync() is sort of a wait with no wait. it consumes the rest of the compute cycle until the physical movement is complete.

Motoman does the same thing. Always reading ahead. A wait/timer of 0 or a NOP command always solves that.