Manual & Guide
Example Source Code
Compatible Image Processing Software
|This discussion is a supplement to the PXC200A User's Guide.
||long WaitAllEvents(long fgh, long ioh, unsigned long mask, unsigned long state, short flags);
fgh: Frame grabber handle.
ioh: IO handle -- should match the frame grabber handle
mask: Shows which lines you are interested in
state: Shows what state you want the lines to have when processing continues
||A queued operation handle if successful.
0 on failure.
Pauses processing of the queue until ALL
I/O events occur.
WaitAllEvents() examines the I/O lines as if by the expression:
((ReadIO(ioh) ^ ~state) & mask).
While the expression is not equal to
mask, the queue is paused. If the expression is equal to mask, the state for
the highest I/O line that was set is cleared, the switch is set to that I/O line
number, and processing of the queue resumes.
This function will fail when mask=0 or when mask has any bits set that represent invalid I/O lines or lines that are output-only.
If you wanted to watch for trigger lines 0 and 1 to go high, you would code that as follows.
WaitAllEvents(fgh, fgh 0x3, 0x3, QUEUED);
Since the trigger lines are inputs, they are numbered 0 thru 3 (output lines are 4 thru 7). You set the mask parameter to 0x3 (0011) to indicate an interest in trigger lines 0 and 1.
Your objective is to wait for the lines to go high, so you set the state parameter to 0x3 (0011). If you wanted to wait for the lines to go low, you would set the state parameter to 0.
In the simplest terms, WaitAllEvents() will pause processing of the queue until trigger lines 0 and 1 are both high. In other words, the queue will be paused until the result of reading the IO (ReadIO(ioh)) matches the result of ANDing mask and state.
The IO lines are read ONLY at each vertical blank. Both lines have to be high at the same reading, but they do not have to go from low to high at the same time.
Evaluating the above expression we get the following.
When ReadIO(ioh) is 0x3, the value of the expression will equal the value of mask and queue processing will proceed.
This function will fail when mask = 0 or when mask has any bits set that
represent invalid I/O lines or lines that are output-only.
The parameter flags is a set of flag bits that can specify modes of operation
for this function. If flags is 0, the default modes will be used.
||GetSwitch(), SetIOType(), SwitchCamera(), SwitchGrab(), WaitAnyEvent()