Appendix B
Register-Level Programming — Port C Status-Word Bit Definitions for Bidirectional Data Path (Port A Only)
©
National Instruments Corporation
B-29
PCI-DIO-96/PXI-6508/PCI-6503 User Manual
Interrupt Handling
You must set the INTEN bit of Interrupt Control Register 2 to enable interrupts. 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 on the PCI-DIO-96 or
PXI-6508, program the counters as described in the
section.
You can use external signals to generate interrupts 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
x
IRQ0; if you are using PC0, set
x
IRQ1, 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,
ensure that the interrupt service routine that you have written acknowledges the interrupt.
On the PCI-DIO-96 and PXI-6508, ensure that the interrupt service routine also writes 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 an 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.
Mode 1 Strobed Input Programming Example
The following example shows how to set up interrupts for mode 1 input for port A.
Write (8255Cnfg, 0xB0)
Set mode 1—port A is an input
Write (8255Cnfg, 0x09)
Set PC4 to enable interrupts from
the 82C55A
Write (IREG2, 0x04)
Set INTEN bit
Write (IREG1, 0x01)
Set AIRQ0 to enable PPI A,
port A interrupts