Servicing the data acquisition operation, Resetting the hardware after a data acquisition op – National Instruments AT-MIO-16X User Manual

Page 191

Advertising
background image

Chapter 5

Programming

AT-MIO-16X User Manual

5-22

© National Instruments Corporation

Servicing the Data Acquisition Operation

Once the data acquisition operation is initiated with the application of
a trigger, the operation must be serviced by reading the ADC FIFO.
The ADC FIFO can be serviced in two different ways. One method is
to monitor the ADCFIFOEF* to read the A/D conversion result every
time one becomes available. Another method is to monitor the
ADCFIFOHF* flag and read in values only when the ADC FIFO is at
least half-full. If the FIFO is half-full, a block of 256 values can be
consecutively read in. The advantage of this second method is that
Status Register 1 needs to be read only once for every 256 values,
while the first method requires one status register to be read per ADC
FIFO read.

To service the data acquisition operation, perform the following
sequence until the data acquisition has completed:

1.

Read Status Register 1 (16-bit read).

2.

If the OVERRUN or OVERFLOW bits are set, the data acquisition
sequence has been halted because one of these error conditions has
occurred. Clear the A/D circuitry by writing to DAQ Clear Register
and determine the cause of the error. OVERRUN and OVERFLOW
are explained in the Status Register 1 section in Chapter 4, Register
Map and Descriptions
.

3.

If the ADCFIFOEF* bit is set (or the ADCFIFOHF* bit), read the
ADC FIFO Register to obtain the result(s).

Interrupts or DMA can also be used to service the data acquisition
operation. These topics are discussed later in this chapter.

Resetting the Hardware after a Data Acquisition Operation

After a data acquisition operation terminates, if no errors occurred and
the sample count was less than or equal to 10000 hex, the AT-MIO-16X
is left in the same state as it was at the beginning of the data acquisition
operation. The counters do not need to be reprogrammed; another data
acquisition operation begins when a trigger is received. If the next
data acquisition operation requires the counters to be programmed
differently, the Am9513A counters that were used must be disarmed
and reset.

Advertising