DNx-AI-208 Analog Input Layer
Chapter 3
13
Programming with the Low-Level API
Tel: 508-921-4600
www.ueidaq.com
Vers:
4.6
Date: November 2013
File:
AI208 Chap3.fm
© Copyright 2009
United Electronic Industries, Inc.
// Start engine
DqStartDQEngine(1000*1, &pDqe, NULL);
// Open communication with IOM
hd0 = DqOpenIOM(IOM_IPADDR0, DQ_UDP_DAQ_PORT, TIMEOUT_DELAY,
&RdCfg);
// Receive IOM crucial identification data
DqCmdEcho(hd0, DQRdCfg);
// Set up channel list
for (n = 0; n < CHANNELS; n++) {
CL[n] = n;
}
STEP 2:
Create and initialize host and IOM sides.
// Now we are going to test device
DqAcbCreate(pDqe, hd0, DEVN, DQ_SS0IN, &bcb);
// Let’s assume that we are dealing with AI-208 device
dquser_initialize_acb_structure();
// Now call the function
DqAcbInitOps(bcb,
&Config,
0, //TrigSize,
NULL, //pDQSETTRIG TrigMode,
&fCLClk,
0, //float* fCVClk,
&CLSize,
CL,
0, //uint32* ScanBlock,
&acb);
printf("Actual clock rate: %f\n", fCLClk);
// Now set up events
DqeSetEvent(bcb,
DQ_eFrameDone|DQ_ePacketLost|DQ_eBufferError|DQ_ePacketOOB);
STEP 3:
Start operation.
// Start operations
DqeEnable(TRUE, &bcb, 1, FALSE);
STEP 4:
Process data.
// We will not use event notification at first - just retrieve scans
while (keep_looping) {
DqeWaitForEvent(&bcb, 1, FALSE, EVENT_TIMEOUT, &events);
if (events & DQ_eFrameDone) {
minrq = acb.framesize;