Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems reading a card in continuous mode

Dear Tom W
 
I have this message to you as requested.
 
Regards
 
Cathy
 
I have been finishing a software project after the original developer left the company. The software runs on a PC target that runs the QNX operating system. NI 6259 and 6602 cards are used to read from/write to a pneumatic test rig. The software is wriiten in C++ and it performs a real time simulation using data read from the rig. We have had numerous problems with the analogue data aquisition. It appears to be writting data to the FIFO buffer and because of intermittent reading of these channels, lags in the data were discovered. The lag can be removed by calling aiClearFifo before the simulation starts. We have also found problems where the scanning rate of the 6259 card is faster than the simulation rate, hence the program reads the data at a slow rate and the simulation results are not accurate.
 
The 6259 reads 9 analogue and 20 digital channels and outputs 4 analogue and 28 digital channels, the simulation will normally run between 200 to 5000 Hz. The DAQ is read from a separate program and this program will send the rig values in a structure to the simulation program every time the simulation requests the data.
 
I am of the opinion that the situation could be improved by only storing one set of results in the FIFO buffer, there would be no lags and the data in the buffer would be the latest available data set so the simulation should read the data at the correct rate. I have not been able to find much information on programming the 6259 card but the attached code is used to initialise the 6259 card.
 
Please could you advise on any changes to the settings to allow only one data set to be stored in the FIFO buffer or advise of any alternative solutions.
 
Many thanks in advance.
 
Cathy
 
0 Kudos
Message 1 of 4
(7,219 Views)
 

Hi Cathy-

Thanks for reposting here.  I would like to ask for some clarification to what you mean by "...only one data set" to be stored in the device FIFO at any given time.  Do you mean one 1X9 array of data (comprising one sample from each channel), or an NX9 array of data (comprising one set of N scans through the 9 channels)?

The reason I ask is that your acquisition appears to be setup in On Demand (aka single point) mode and not continuous mode.  Given that, the FIFO should only contain one 1X9 scan, assuming you're initiating the FIFO read process by calling aiStartOnDemand() as shown in the M Series MHDDK examples.  Can you please share the portion of code that shows the calls to aiStartOnDemand and the actual FIFO read operations?

Thanks-

Tom W
National Instruments
0 Kudos
Message 2 of 4
(7,215 Views)

Dear Tom,

Many thanks for you interest. We would like to read one 1X9 array of data under control of the simulation program.

I have attached portions of the code as requested. Function DaqDriver::TriggerAIConversion() calls function aiStartOnDemand(). Function DaqDriver::ReadAIResults() waits for the conversion to complete then calls function DaqDriver::ReadAIFifoValue() 9 times to read the channels.

There is a loop that calls function DaqDriver::TriggerAIConversion()  and function DaqDriver::ReadAIResults()  (via an intermediate function) everytime the the simulation program requests data.

Many thanks in advance.

Regards,

Cathy

0 Kudos
Message 3 of 4
(7,199 Views)
I have had numerous problems reading the DAQ card in a continuous mode.  Currently I'm doing hardware timed data acquisition reading 50 points per loop at 250 kHz (200 us) with 250 us per loop and transferring using DMA  transfers.  There are many potential problems with continuous acquisition where you lose track of inputs because the card outputs the values as a0, a1, a2, a0, a1, ..., for example.  If you lose track because of any buffer overflows, my 13 hours 15 minutes at 180 kHz bug that appears to be in the DDK that I can't track down, etc., it is difficult to determine this has happened.  Assuming you want multiple points per channel per loop, I recommend a hardware timed acquisition for a particular number of points.  Then you start the acquisition, read the data, aiArm(board, kTrue), aiStart(board), analyze the data, wait for the acquisition to finish, read the data, re-arm and start, etc.  This assumes you want more than one data point per channel per loop.  If not, the acquisition on demand would probably be sufficient.  Just some thoughts.

Aaron
0 Kudos
Message 4 of 4
(7,151 Views)