
Chapter 4
Programming
© National Instruments Corporation
4-67
AT-MIO-16D User Manual
5. Clear the A/D circuitry and reset the multiplexer counter.
Before starting the data acquisition operation, the A/D FIFO must be emptied to clear out any old
A/D conversion results. This emptying must be done after the counters are programmed in case
any spurious edges were caused while programming the counters. Write 0 to the A/D Clear
Register to empty the FIFO (16-bit write).
Write 0 to the Mux-Counter Register to set the analog input circuitry to the first channel and gain
setting of the scan sequence.
Write 0 to the INT2CLR Register to clear any spurious edge caused by programming Counter 2.
6. Enable the scanning data acquisition operation.
To enable the scanning data acquisition operation such that A/D conversions begin when a
trigger is received, set the DAQEN bit and the SCANEN bit in Command Register 1. To enable
the scan interval timing, set the SCN2 bit in Command Register 2.
7. Apply a trigger.
Once set up by the preceding steps, the data acquisition operation is initiated when a trigger is
received. A trigger can be provided in one of two ways–through software or through hardware.
To initiate the data acquisition operation through software, write 0 to the Start DAQ Register.
To initiate the data acquisition operation through hardware, apply an active low pulse to the
START TRIG* pin on the AT-MIO-16D I/O connector. See the Data Acquisition Timing
Connections section in Chapter 2, Configuration and Installation, for START TRIG* signal
specifications.
Once the trigger is applied, Counter 3 generates pulses initiating A/D conversions once every
sample interval until the sample counter reaches 0 and the last scan cycle is completed. Counter
2 generates a scan interval for each cycle through the scan sequence in the mux-gain memory.
8. Service the data acquisition operation.
Once the data acquisition operation is started by application of a trigger, the operation is serviced
by reading the A/D FIFO Register every time an A/D conversion result becomes available. To
do this, perform the following sequence until the desired number of conversion results have been
read:
a. Read the Status Register (16-bit read).
b. If the CONVAVAIL bit is set (bit 13), read the A/D FIFO Register to obtain the result.
Interrupts or DMA can also be used to service the data acquisition operation. These topics are
discussed later in this chapter.
Two error conditions may occur during a data acquisition operation–an overflow error or an
overrun error. These error conditions are reported through the Status Register and should be
Summary of Contents for AT-MIO-16D
Page 16: ......
Page 23: ......
Page 185: ......
Page 206: ......
Page 207: ......
Page 208: ......
Page 209: ......
Page 210: ......
Page 211: ......
Page 212: ......
Page 213: ......
Page 214: ......
Page 215: ......
Page 216: ......
Page 217: ......
Page 218: ......
Page 219: ......
Page 220: ......
Page 221: ......
Page 222: ......
Page 223: ......
Page 224: ......
Page 225: ......
Page 226: ......
Page 227: ......
Page 228: ......
Page 229: ......
Page 230: ......
Page 231: ......
Page 232: ......
Page 233: ......
Page 234: ......
Page 235: ......
Page 236: ......
Page 237: ......
Page 238: ......
Page 239: ......
Page 240: ......
Page 241: ......
Page 242: ......
Page 243: ......
Page 244: ......
Page 246: ......
Page 247: ......
Page 248: ......
Page 249: ......
Page 250: ......
Page 251: ......
Page 252: ......
Page 253: ......
Page 254: ......
Page 255: ......
Page 256: ......
Page 257: ......
Page 258: ......
Page 259: ......
Page 260: ......
Page 261: ......