Sensoray Instruction Manual 16 Model 626 Driver for Windows
Notes: This function performs a sequence of A/D conversions, as specified by a poll list, and stores the signed, digitized
data values in the databuf[] array. It is the equivalent of calling two other functions in sequence:
S626_StartADC() and S626_WaitDoneADC().
When called, this function launches an I/O channel program that runs on a dedicated I/O processor residing on the
Model 626 board. The I/O processor runs independently of the system processor so that, regardless of what is
happening in the Windows environment, the time interval between the A/D acquisitions specified in the poll list
will be deterministic.
Before calling this function, S626_ResetADC() must be called to convert the target poll list into an equivalent I/O
channel program. In addition, S626_ResetADC() must be called again if the poll list is modified in any way.
Example: See Section 4.3.5.
4.3.5 A/D Programming Examples
4.3.5.1 Example: Scattered Acquisition
/////////////////////////////////////////////////////////////////////////////
// Digitize channels 2, 3 and 6 on board number 0.
/////////////////////////////////////////////////////////////////////////////
#define RANGE_10V 0x00 // Range code for ADC ±10V range.
#define RANGE_5V 0x10 // Range code for ADC ±5V range.
#define EOPL 0x80 // ADC end-of-poll-list marker.
#define CHANMASK 0x0F // ADC channel number mask.
// Allocate data structures. We allocate enough space for maximum possible
// number of items (16) even though this example only has 3 items. Although
// this is not required, it is the recommended practice to prevent programming
// errors if your application ever modifies the number of items in the poll list.
BYTE poll_list[16]; // List of items to be digitized.
SHORT databuf[16]; // Buffer to receive digitized data.
// Populate the poll list.
poll_list[0] = 2 | RANGE_10V; // Chan 2, ±10V range.
poll_list[1] = 3 | RANGE_5V; // Chan 3, ±5V range.
poll_list[2] = 6 | RANGE_10V | EOPL; // Chan 6, ±10V range, mark as list end.
// Prepare for A/D conversions by passing the poll list to the driver.
S626_ResetADC( 0, poll_list );
// Digitize all items in the poll list. As long as the poll list is not modified,
// S626_ReadADC() can be called repeatedly without calling S626_ResetADC() again.
// This could be implemented as two calls: S626_StartADC() and S626_WaitDoneADC().
S626_ReadADC( 0, databuf );
// Display all digitized binary data values.
for ( int i = 0; i <= 2; i++ )
printf( "Channel %d = %d\n", poll_list[i] & CHANMASK, databuf[i] );
4.3.5.2 Example: Oversampling
/////////////////////////////////////////////////////////////////////////////
// Average sixteen measurements from analog input channel 2, board number 0.
// Channel 2 will be digitized on the ±10V input range.
/////////////////////////////////////////////////////////////////////////////
#define EOPL 0x80 // ADC end-of-poll-list marker.
SHORT databuf[16]; // Buffer to receive digitized data.