National Instruments 320174B-01 Computer Hardware User Manual


 
Chapter 4 Register-Level Programming
© National Instruments Corporation 4-51 Lab-NB User Manual
Two error conditions may occur during a DAQ operation: an overflow error or an overrun error.
These error conditions are reported through the Status Register and should be checked every time
the Status Register is read to check the DAVAIL bit.
An overflow condition occurs if more than 16 A/D conversions have been stored in the A/D
FIFO without the A/D FIFO being read; that is, the A/D FIFO is full and cannot accept any more
data. This condition occurs if the software loop reading the A/D FIFO Register is not fast
enough to keep up with the A/D conversion rate. When an overflow occurs, at least one A/D
conversion result is lost. An overflow condition has occurred if the OVERFLOW bit in the
Status Register is cleared.
An overrun condition occurs if a second A/D conversion is initiated before the previous
conversion is finished. This condition may result in one or more missing A/D conversions. This
condition occurs if the sample interval is too small (sample rate is too high). An overrun
condition has occurred if the OVERRUN bit in the Status Register is low. The minimum
recommended sampling interval on the Lab-NB is 16 µsec.
Both the OVERFLOW and OVERRUN bits in the Status Register are reset by writing to the A/D
Clear Register.
Programming in Freerun Acquisition Mode
Posttrigger Mode
A posttrigger data acquisition in freerun acquisition mode using EXTCONV* requires a
programming sequence similar to controlled acquisition mode, except that steps 5c and 5d are
not performed. The sample count is kept in software and conversions remain enabled until
GATA0 is set high. GATA0 can be set low by writing 34 (hex) to the Counter A Mode Register
after the required number of samples is obtained. This disables EXTCONV*, that is, further
transitions on EXTCONV* are ignored.
Pretrigger Mode
Pretriggering mode requires that the A/D conversions be shut off at a programmed time by the
hardware after the trigger on EXTTRIG. Therefore, pretriggered data acquisition is not possible
in freerun acquisition mode.
Programming Multiple A/D Conversions with Channel Scanning
The data acquisition programming sequences given earlier in this chapter are for programming
the Lab-NB for multiple A/D conversions on a single input channel. The Lab-NB can also be
programmed for scanning analog input channels during the DAQ operation. Analog channels N
through 0 can be scanned, where N can be 1 through 7. Programming scanned multiple A/D
conversions involves the same sequence of steps as single-channel DAQ operations except that
the SCANEN bit is set in the A/D Configuration Register. When the SCANEN bit is set in the
A/D Configuration Register, the analog channel select bits MA<2..0> specify the highest
numbered channel in the scan sequence. For example, if MA<2..0> is 011 (binary)–that is,
channel 3 is selected and the SCANEN bit is set—the following scan sequence is used: