MATLAB Programming/Psychtoolbox/Screen Commands/WaitVBL
Wait specified number of blankings (frame endings). Call with waitFrames=1 (or omit it, since that's the default) to wait for the beginning of the next frame. Video cards mark the end of each video frame by briefly reducing the voltage to the Vertical Blanking Level (VBL), which "blanks" the screen to black. We do all video timing relative to the beginning of blanking. You may want to run WaitBlanking at high priority (see Rush and Priority) for reliable timing. To keep this routine as fast as possible, no value is returned unless you supply an argument to receive it. When processor priority is at or below MaxPriorityForBlankingInterrupt the WaitBlankingUsesInterrupt 'Preference' controls, for each screen, whether 'WaitBlanking' calls SetClut (default) or waits for a blanking interrupt. When processor priority is above MaxPriorityForBlankingInterrupt, 'WaitBlanking' always uses SetClut (i.e. cscSetEntries or cscDirectSetEntries call to video driver).