PXC Family

Datasheet (PDF)

Manual & Guide

Application Notes

Driver Updates

Example Source Code

Compatible Image Processing Software

Product FAQ

Home Page


Feedback at:
CSinfo@cyberoptics.com or
1-800-366-9131

WaitAllEvents()
This discussion is a supplement to the PXC200A User's Guide.
Syntax 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
Return Value A queued operation handle if successful.
0 on failure.
Description

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.

Example

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);

Explanation

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.

ReadIO(ioh) 0011
^
!State      1100
----------------
            1111
&
Mask        0011
----------------
            0011

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.

See Also GetSwitch(), SetIOType(), SwitchCamera(), SwitchGrab(), WaitAnyEvent()