Programming
Chapter 4
AT-DIO-32F User Manual
4-46
© National Instruments Corporation
Example: Interrupt Generation on DRDY2
Instead of polling the DRDY2 bit, interrupts can be used to wait for the DRDY2 condition. The
interrupt service routine can then write or read the data to or from Group 2. To use interrupts for
this task, follow these steps:
1. Set up Group 2 with the desired handshaking mode and direction.
2. Set the INTEN2 bit in the CFG2 Register to enable interrupts on DRDY2.
3. When DRDY2 is set, an interrupt request is asserted and software control enters the interrupt
service routine.
In the interrupt service routine, follow these steps:
a. Check the DRDY2 bit in the STAT Register to verify that the current interrupt was
generated by a DRDY2 condition.
b. Write or read data to or from Group 2.
When DRDY2 becomes set again, software control again jumps to the interrupt service
routine.
Example: Interrupt Generation on Group 1 DMA Terminal Count
The DMA terminal count signals the end of the current DMA transfer. To use the Group 1 DMA
terminal count interrupt service routine, follow these steps:
1. Set up Group 1 with the desired handshaking mode and direction.
2. Set the TCINTEN1 bit in the CFG3 Register to enable interrupts on Group 1 DMA terminal
counts.
3. Enable DMA for Group 1 transfers.
4. Program the PC DMA controller.
5. When a Group 1 DMA terminal count is received, an interrupt request is asserted and
software control enters the interrupt service routine.
In the interrupt service routine, follow these steps:
a. Check the DMATC1 bit in the STAT Register to verify that the current interrupt was
generated by a Group 1 DMA terminal count condition.
b. Perform the desired work.
c. Write to the DMACLR1 Register to acknowledge that the Group 1 DMA terminal count
interrupt condition has been serviced.
When another Group 1 DMA terminal count is received, software control again jumps to the
interrupt service routine.
Содержание AT-DIO-32F
Страница 19: ......
Страница 101: ......
Страница 102: ......
Страница 123: ......
Страница 124: ......
Страница 125: ......
Страница 126: ......
Страница 127: ......
Страница 128: ......
Страница 129: ......
Страница 130: ......
Страница 131: ......
Страница 132: ......
Страница 133: ......
Страница 134: ......
Страница 135: ......
Страница 136: ......
Страница 137: ......
Страница 138: ......
Страница 139: ......
Страница 140: ......
Страница 141: ......
Страница 142: ......
Страница 143: ......