Interrupt programming examples, Interrupt handling – National Instruments PC-DIO-24 User Manual

Page 45

Advertising
background image

Chapter 4

Register-Level Programming

© National Instruments Corporation

4-15

PC-DIO-24 User Manual

/* EXAMPLE 3–Set up interrupts for mode 1 output for port A. Select PC4 as
the interrupt enable bit. */

outp(cnfg,0xA0);

/* Port A is an output in mode 1. */

outp(cnfg,0x0D);

/* Set PC6 to enable interrupts from

82C55A. */

outp(cnfg,0x0C);

/* Clear PC4 to enable interrupts. */

/* EXAMPLE 4–Set up interrupts for mode 1 output for port B. Select PC4 as
the interrupt enable bit. */

outp(cnfg,0x84);

/* Port B is an output in mode 1. */

outp(cnfg,0x05);

/* Set PC2 to enable interrupts from

82C55A. */

outp(cnfg,0x08);

/* Clear PC4 to enable interrupts. */

/* EXAMPLE 5–Set up interrupts for mode 2 output transfers. Select PC2 as the
interrupt enable bit. */

outp(cnfg,0xC0);

/* mode 2 output */

outp(cnfg,0x0D);

/* Set PC6 to enable interrupts from

82C55A. */

outp(cnfg,0x04);

/* Clear PC2 to enable interrupts. */

/* EXAMPLE 6–Set up interrupts for mode 2 input transfers. Select PC2 as the
interrupt enable bit. */

outp(cnfg,0xD0);

/* mode 2 input */

outp(cnfg,0x09);

/* Set PC4 to enable interrupts from

82C55A. */

outp(cnfg,0x04);

/* Clear PC2 to enable interrupts. */

}

Interrupt Handling

A jumper setting on the PC-DIO-24 selects the signal that is used for the interrupt enable signal.
If jumper W1 is set to N/C, interrupts are disabled. Jumper W1 can be used to select PC2, PC4,
or PC6 as the active low interrupt enable signal. For example, if PC2 is selected, interrupts are
enabled if PC2 is logic low. If PC2 is logic high, interrupts from the PC-DIO-24 are disabled.
The following table summarizes which signal should be used as the interrupt enable for all mode
combinations.

Advertising