Interrupt-Based DA Conversion Scan

Universal Driver Documentation

Description

Interrupt-based analog output is useful for generating analog output values automatically at a specified rate, such as generating an analog waveform. It differs in operation from a single D/A conversion scan in that it generates output data continuously or for a specified number of samples each time the function is called. There are a number of different options that can be set for interrupt-based operations; these are explained in the interrupt-based operations chapter.

The Universal Driver function for performing interrupt-based D/A conversion scans is dscDAConvertScanInt().

Step-By-Step Instructions

Create and initialize an analog I/O interrupts structure (DSCAIOINT).

Set the entries of the sample_values buffer in the DSCAIOINT structure to the desired output codes. You must have num_conversion entries of size, WORD, in the buffer to ensure proper operation.

Call dscDAConvertScanInt() and pass it a pointer to the above-mentioned DSCAIOINT structure to begin interrupt operation. The interrupt operations will now run in a separate system thread until either they reach the maximum number of conversions specified (one-shot mode only) or they are cancelled by a call to dscCancelOp.

Example of Usage for Interrupt-Based D/A Scan

...

DSCB dscb;
DSCAIOINT dscaioint;
int i;

/* Step 1 */
dscaioint.num_conversions = 1024;
dscaioint.conversion_rate = 10000;
dscaioint.cycle = FALSE;
dscaioint.internal_clock = TRUE;
dscaioint.low_channel = 0;
dscaioint.high_channel = 3;
dscaioint.external_gate_enable = FALSE;

/* Step 2 */
dscaioint.sample_values = (WORD*)malloc(sizeof(WORD) * dscaioint.num_conversions);

for (i = 0; i < dscaioint.num_conversions; i++)
dscaioint.sample_values[i] = (WORD)4095;

/* Step 3 */
if ((result = dscDAConvertScanInt(dscb, &dscaioint)) != DE_NONE)
		return result;

...


This page was last modified 19:43, 30 Jan 2004.
Copyright (c) 2004 Diamond Systems. All Rights Reserved.