beautypg.com

Sensoray 711 User Manual

Page 30

background image

Sensoray Model 711 Instruction Manual

31

to be called. Also, this function has to be called after the interrupt occurs, because the
system part of the interrupt handling procedure masks the interrupts.

Example
/* global section */
/* define USER type to pass data to/from the user interrupt
handling function. Assume components' types are defined */
struct USER {
SOMETYPE user1;
ANOTHERTYPE user2;
YETANOTHERTYPE user3;
};
struct USER user;
INT_DATA intdata;
/* end of global section */

ECODE ecode;
HFG hfg;
BUFFER buffer;
BOOL enough;

/* Initialize the system, allocate buffer(s), get handles here
*/

/* Set up INT_DATA */
intdata.hfg = hfg;
intdata.mask = STATUS_READY;
intdata.func = UserFunc;

//see below;

intdata.priority = THREAD_PRIORITY_NORMAL;

/* Set up the necessary user data */
user.user2 = NOT_READY; //some user flag;

/* Enable interrupt */
if (!(ecode = X11_InterruptOn (&intdata))) {
if (!(ecode = X11_InterruptUnmask (hfg, STATUS_READY))) {
/* start acquisition */
X11_StartAcquire (hfg, buffer.hbuf, AMODE_SINGLE);
/* do whatever is necessary here,
for example: */
while (!enough) {
if (user.user2 == READY) {
user.user2 = NOT_READY;
/* start next acquisition */

X11_InterruptUnmask (hfg, STATUS_READY);

X11_StartAcquire (hfg, buffer.hbuf,
AMODE_SINGLE);
/* image is ready, do something with it*/
}
}
} else {
return ecode;
}
} else {