Справочник Пользователя для National Instruments PCI-DIO-96

Скачать
Страница из 93
Chapter 6
Programming
PCI-DIO-96 User Manual
6-20
©
 National Instruments Corporation
Interrupt Handling
You must set the INTEN bit of Interrupt Control Register 2 to enable 
interrupts from the PCI-DIO-96. Clear this bit first to disable unwanted 
interrupts. After all sources of interrupts have been disabled or placed 
in an inactive state, you can set INTEN. You must set INTEN before 
you generate an interrupt for proper operation.
To interrupt the computer using one of the 82C55A devices, program 
the selected 82C55A for the I/O mode desired. In mode 1, set either the 
INTEA or the INTEB bit to enable interrupts from port A or port B, 
respectively. In mode 2, set either INTE1 or INTE2 for interrupts on 
output or input transfers, respectively. The INTE1 and INTE2 interrupt 
outputs are cascaded into a single interrupt output for port A. After you 
enable interrupts from the 82C55A, set the appropriate enable bit for the 
selected 82C55A; for example, if you select both mode 2 interrupts for 
PPI C, set CIRQ0 to interrupt the computer.
To interrupt the computer using one of the 82C53 counter outputs, 
program the counters as described in the Interrupt Programming 
Example 
section later in this chapter.
You can use external signals to interrupt the PCI-DIO-96 when port A 
or port B is in mode 0 and the low nibble of port C is configured for 
input. If port A is in mode 0, use PC3 to generate an interrupt; if port B 
is in mode 0, use PC0 to generate an interrupt. After you have 
configured the selected 82C55A, you must set the corresponding 
interrupt enable bit in Interrupt Control Register 1. If you are using 
PC3, set xIRQ0; if you are using PC0, set xIRQ1, where x is the letter 
corresponding to the PPI you want to generate interrupts (A–D). When 
the external signal becomes logic high, an interrupt request occurs. To 
disable the external interrupt, the interrupt service routine that you have 
written should acknowledge the interrupt and write the interrupt clear 
register.
Interrupt Programming Examples for the 82C55A
The following examples show the process required to enable interrupts 
for several different operating modes. You must write and install the 
interrupt service routine in order to process the interrupt and gain any 
useful knowledge from it. You should clear all interrupt sources and 
interrupt enable bits first to disable unwanted interrupts.