DNx-AI-208 Analog Input Layer
Chapter 3
15
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.
for (i = 0; i < DQ_MAXDEVN; i++) {
if (DQRdCfg->devmod[i]) {
printf("Model: %x Option: %x\n", DQRdCfg->devmod[i],
DQRdCfg->option[i]);
} else {
break;
}
}
STEP 2:
Create and initialize host and IOM sides.
DqDmapCreate(pDqe, hd0, &pBcb, UPDATE_PERIOD, &dmapin, &dmapout);
STEP 3:
Add channels into DMap.
for (i = 0; i < CHANNELS; i++) {
DqDmapSetEntry(pBcb, DEVN, DQ_SS0IN, i, DQ_ACB_DATA_RAW, 1,
&ioffset[i]);
}
DqDmapInitOps(pBcb);
DqeSetEvent(pBcb,
DQ_eDataAvailable|DQ_ePacketLost|DQ_eBufferError|DQ_ePacketOOB);
STEP 4:
Start operation.
DqeEnable(TRUE, &pBcb, 1, FALSE);
STEP 5:
Process data.
while (keep_looping) {
DqeWaitForEvent(&pBcb, 1, FALSE, timeout, &eventsin);
if (eventsin & DQ_eDataAvailable) {
+;
printf("\ndata ");
for (i = 0; i < CHANNELS; i++) {
printf("%04x ", *(uint32*)ioffset[i]);
}
}
}
STEP 6:
Stop operation.
DqeEnable(FALSE, &pBcb, 1, FALSE);
STEP 7:
Clean up.
DqDmapDestroy(pBcb);
DqStopDQEngine(pDqe);
DqCloseIOM(hd0);
#ifndef _WIN32
DqCleanUpDAQLib();
#endif