Appendix C Register-Level Programming
PC-DIO-24/PnP User Manual C-22
©
National Instruments Corporation
outp(ireg1,0x02); /* Set IRQ1 to enable port B interrupts. */
outp(ireg2,0x04); /* Set INTEN bit. */
/* EXAMPLE 5–Set up interrupts for mode 2 output transfers. Enable the
appropriate interrupt bits. */
outp(cnfg,0xC0); /* Mode 2 output. */
outp(cnfg,0x0D); /* Set PC6 to enable interrupts from 82C55A. */
outp(ireg1,0x01); /* Set IRQ0 to enable port A interrupts. */
outp(ireg2,0x04); /* Set INTEN bit. */
/* EXAMPLE 6–Set up interrupts for mode 2 input transfers. Enable the
appropriate interrupt bits. */
outp(cnfg,0xD0); /* Mode 2 input. */
outp(cnfg,0x09); /* Set PC4 to enable interrupts from 82C55A. */
outp(ireg1,0x01); /* Set IRQ0 to enable port A interrupts. */
outp(ireg2,0x04); /* Set INTEN bit. */
}
Interrupt Handling
Note: This section applies only to the PC-DIO-24PnP. The PC-DIO-24
(non-PnP) does not implement the IRQ1, IRQ2, or INTEN bits. To enable
and disable interrupts on the non-PnP board, see AppendixD, Using Your
PC-DIO-24 (Non-PnP) Board.
On the PC-DIO-24PnP, the INTEN bit of Interrupt Register 2 must be
set to enable interrupts. This bit must first be cleared to disable
unwanted interrupts. After all sources of interrupts have been disabled
or placed in an inactive state, you can set INTEN.
To interrupt the host computer, program the selected 82C55A port for
the I/O mode desired. In mode 1, set either the INTEA or the INTEB bit
to enable interrupts from portA 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 enabling interrupts from the
82C55A, set the appropriate enable bit in Interrupt Control Register 1;
for example, if you selected both mode2 interrupts for port A, you
would set IRQ0 in order to interrupt the host computer.
External signals can be used to interrupt the PC-DIO-24/PnP when
port A or port B is in mode 0 and the low nibble of portC is configured
for input. If port A is in mode 0, use PC3 to generate an interrupt; if