The function dscGetStatus() is used to indicate the current status of any interrupt operation, including A/D sampling, D/A conversions, digital input, digital output, and user interrupts. It provides several status indicators (see the definition for the data structure DSCS on page 167 for complete details):
The common convention for using this function is to start a particular interrupt function, and then go into a while loop that terminates when a specified condition has occurred, such as when a specified timeout has been reached or when the interrupt operation completes. Completion is indicated by the status indicator OP_TYPE_NONE.
Create and initialize a driver status structure (DSCS). Call dscGetStatus() and pass it a pointer to this structure in order to return the current interrupt operation status. The two important elements to note in the DSCS structure are op_type and transfers. After calling dscGetStatus(), these elements will contain the interrupt operation status and current number of transfers respectively.
/* run the interrupt operation for 30 seconds, then cancel */ #define TIMEOUT_MS 30000 DSCS dscs; DWORD time_last, time_now; /* Start interrupt function - dscADSampleInt() etc. */ dscGetTime(&time_last); do { dscGetTime(&time_now); if (time_now - time_last > TIMEOUT_MS) { dscCancelOp(dscb); break; } time_last = time_now; dscGetStatus(dscb, &dscs); } while (dscs.op_type != OP_TYPE_NONE);
This page was last modified 22:01, 21 Sep 2004.
Copyright (c) 2004 Diamond Systems. All Rights Reserved.