
Appendix B
Register-Level Programming
DAQCard-DIO-24 User Manual
B-24
©
National Instruments Corporation
/* EXAMPLE 3–Set up interrupts for mode 1 output for port A. Enable the
appropriate interrupt bits. */
wrt(cnfg,0xA0);
/* Port A is an output in mode 1. */
wrt(ireg1,0x01);
/* Set IRQ0 to enable port A interrupts.*/
wrt(cnfg,0x0D);
/* Set PC6 to enable interrupts from */
/* 82C55A. */
wrt(ireg2,0x04);
/* Set INTEN bit. */
/* EXAMPLE 4–Set up interrupts for mode 1 output for port B. Enable the
appropriate interrupt bits. */
wrt(cnfg,0x84);
/* Port B is an output in mode 1. */
wrt(ireg1,0x02);
/* Set IRQ1 to enable port B interrupts. */
wrt(cnfg,0x05);
/* Set PC2 to enable interrupts from */
/* 82C55A. */
wrt(ireg2,0x04);
/* Set INTEN bit. */
/* EXAMPLE 5–Set up interrupts for mode 2 output transfers. Enable the
appropriate interrupt bits. */
wrt(cnfg,0xC0);
/* Mode 2 output */
wrt(ireg1,0x01);
/* Set IRQ0 to enable port A interrupts. */
wrt(cnfg,0x0D);
/* Set PC6 to enable interrupts from */
/* 82C55A. */
wrt(ireg2,0x04);
/* Set INTEN bit. */
/* EXAMPLE 6–Set up interrupts for mode 2 input transfers. Enable the
appropriate interrupt bits. */
wrt(cnfg,0xD0);
/* Mode 2 input */
wrt(ireg1,0x01);
/* Set IRQ0 to enable port A interrupts. */
wrt(cnfg,0x09);
/* Set PC4 to enable interrupts from */
/* 82C55A. */
wrt(ireg2,0x04);
/* Set INTEN bit. */
}
Interrupt Handling
To enable interrupts from the DAQCard-DIO-24, set the INTEN bit of
Interrupt Register 2. First, clear this bit to disable unwanted interrupts.
After all sources of interrupts have been disabled or placed in an
inactive state, set INTEN.
To interrupt the host computer using the 82C55A, program the 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 cascade into a