Hi,
I am new to NI-DAQ C programming and we have a PCI-6534 card for data aquisition.
I started with an included example and try to work my way out. Essentially, we are dealing with a sensor chip which generates data (about 2 MHz 8-bit) and provide a data latching signal (RE).
During data aquisition, we want to make the PCI-6534 work like a slave and just listen to the data port (port A) and latch the signal according to the follwing edge of the RE output from the chip. The RE is connected to the 6534's REQ1 pin. There will be about 400K byte data for each of operation and the data does not need to be realtime.
My question is, which flow should I use. From the user manual, I picked the "level-ACK" hand shaking flow. Though "ACK" is not connected in our case, I assume it can still listen to the REQ1 pin. Here is our code:
----Start Here----
static i16 piBuffer[400000] = {0};
u32 ulCount = 400000;
u32 ulRemaining = 1;
(....chip initialization & register read/write...)
iStatus = DIG_Grp_Config(
iDevice,
iGroup, // 1: Port A
iGroupSize, // 1: 8-bit
iPort, // 0: Port A
iDirIn);
iStatus = DIG_Grp_Mode(
iDevice,
iGroup,
0, // Protocol: 0 = level-ACK
0, // Edge: 0 = leading edge
1, // reqPol: 1=active low
0, // ackPol: (don't care)
0); // ackDelayTime (don't care)
iStatus = DIG_Block_PG_Config(
iDevice,
iGroup, // 1: Port A
iPgConfig, // 1: "0" does not work
iReqSource, // 1: from REQ pin
iPgTB, // 3 (don't care)
iReqInt, // 10 (don't care)
iExtGate // 0 (don't care)
);
iStatus = DIG_Block_In(
iDevice,
iGroup,
piBuffer,
ulCount
);
while ((ulRemaining != 0) && (iStatus == 0)) {
iStatus = DIG_Block_Check(
iDevice, iGroup, &ulRemaining);
iRetVal = NIDAQYield(iYieldON);
}
(.... Access data at piBuffer...)
---- End Here ----
With the above program, data capture ran through but the data itself has some problems. Seems like the same data pattern repeats itself several times before having a different data set, which is not the way it should be. Seems like the DAQ card does not really wait for the data latching signal from REQ1 to capture each data. Did I do anything wrong?
We have another LabView program running and we used that to verify the device can capture data correctly. However, we just can't do the same thing on C (The LabView program was prepared by a very remote team and we cannot have easy access to their knowledge).
Thanks.
Regards,
JK