![]() |
|
di_anout
is an immediate function that writes (outputs) a 2's complement, left justified value to the DAC.
Note: The di_anout
function will be ignored while output scanning or simultaneously input and output scanning.
int di_anout (dac_data, range); |
|
unsigned dac_data; |
/* value to ouput to the DAC */ |
unsigned range; |
/* specifies which DAC to write to OR unipolar/bipolar (22x products) */ |
The value that gets written to the DAC is instrument dependent.
12-bit: | DI-158, DI-220, DI-221, DI-222 | |
14-bit: | DI-400, DI-410, DI-500, DI-510,DI-720, DI-730, DI-78x, and DI-5001 |
See Converting Counts to Volts.
range
specifies which DAC to write to or, for DI-220, DI-221TC, and DI-222 instruments, bipolar/unipolar operation.
DI_NO_ERR | No error |
DI_OPENED_ERR | Device not opened |
DI_COMM_ERR | Communication error |
DI_ANOUT_ERR | Analog output error |
Note: If di_close
is called immediately after di_anout
, the device will close before di_anout
is completed.
Use the following tables for reference.
#include "200sdk.h" |
|
int i; |
|
char errstr[255]; |
|
main() |
|
{ |
|
if(errcode = di_open()){ |
/* open the device for comm */ |
di_strerr(errcode,errstr); |
|
printf("%s",errstr); |
|
} |
|
else |
|
printf("Device installed successfully.....\n"); |
|
i = 5 . 16; |
/* this left justifies the data */ |
i = i & 0XFFFC; |
/* the lower 2 bits should be zero */ |
if(errcode = di_anout(i,0)){ |
/* output i to DAC */ |
di_strerr(errcode,errstr); |
|
printf("%s",errstr); |
|
} |
|
else |
|
printf("Analog output successful.....\n"); |
|
di_close (); |
|
} |
Copyright © DATAQ Instruments, Inc.