Example: Sending a digital trigger on Pixel Sync
In this example we will send a digital trigger on the next Pixel Sync, via the digital output on the DATAPixx I/O hub.
We start by defining
a pixel sequence to act as our cue for Pixel Sync
a digital output state we wish to execute when this sequence appears
Then we send our command to register write on Pixel Sync.
Once you have sent a call to RegWrPixelSync, you will want to flip your pixel sequence to the display relatively quickly. While RegWr is not a blocking function, it will place the DATAPixx I/O hub in a “busy” state and stop you from being able to execute other register writes and updates until the pixel trigger is detected.
In order to stop the RegWrPixelSync command from hanging for too long, there is a “timeout” variable which specifies the number of video frames before the register write will automatically execute. In our example we set the timeout to a reasonable period (60 frames).
We recommend a trigger sequence of at least 8 pixels when using PixelSync, to ensure the trigger is unique. To align the trigger with stimulus onset, the pixels should be embedded in the top of your stimuli, without any blending or dithering applied.