Chapter 4
Programming
© National Instruments Corporation
4-77
AT-MIO-16D User Manual
3. Program the DMA controller to set up two DMA channels and two memory buffers for each
DMA channel data collection.
4. After the DMA service, write 0 to either the DMATC Clear Register or the A/D Clear
Register.
During the DMA operation, DMA Channel 1 and Memory Buffer 1 (DMA 1) are served first.
When a DMA terminal count is received, the board automatically switches the DMA operation to
DMA Channel 2 and Memory Buffer 2 (DMA 2). Therefore, the board can collect data into one
buffer and service data in another buffer simultaneously. If the DMA controller is programmed
for auto-reinitialize mode, DMA 1 and DMA 2 are continuously served in turn.
Interrupt Programming
Four different interrupts are generated by the AT-MIO-16D board:
•
An interrupt whenever a conversion is available to be read from the A/D FIFO
•
An interrupt whenever a DMA terminal count is received
•
An interrupt whenever a data acquisition operation is completed (either normally or due to an
error condition)
•
An interrupt whenever a rising edge on the OUT2 pin of the Am9513A is detected.
These four interrupts are enabled individually. To use any one of these interrupts, the overall
interrupt enable bit INTEN in Command Register 2 must be set.
To use the conversion interrupt, set the CONVINTEN bit in Command Register 1 and the
INTEN bit in Command Register 2. If these bits are set, if an interrupt occurs from the AT-MIO-
16D board, and if the CONVAVAIL bit in the Status Register is set, then a conversion interrupt
has occurred. Reading from the A/D FIFO Register clears this interrupt condition. Writing to
the A/D Clear Register also clears the conversion interrupt.
To use the DMA terminal count interrupt, set the DMAEN and TCINTEN bits in Command
Register 1 and the INTEN bit in Command Register 2. If these bits are set, if an interrupt occurs
from the AT-MIO-16D board, and if the DMATC bit in the Status Register is set, then a DMA
terminal count interrupt has occurred. Writing to the DMA TC INT Clear Register or to the A/D
Clear Register clears this interrupt condition.
To use the data acquisition completion interrupt, set the DAQSTOPINTEN bit in Command
Register 1 and the INTEN bit in Command Register 2. If these bits are set, if an interrupt occurs
from the AT-MIO-16D board, and if the DAQSTOPINT bit in the Status Register is set, then a
data acquisition completion interrupt has occurred. If either the OVERFLOW or the OVERRUN
bit is set in the Status Register, this interrupt is the result of a data acquisition termination error
condition. Otherwise, the normal data acquisition completion interrupt has occurred. Writing to
the A/D Clear Register clears the data acquisition completion interrupt and the error condition if
any are set.
To use the OUT2 interrupt, set the INTEN and the INT2EN bits in Command Register 2. If
these bits are set, if a rising edge occurs on OUT2, and if the OUT2INT bit in the Status Register
is set, then an OUT2 interrupt has occurred. Writing to the INT2CLR Register clears the OUT2
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: ......