![background image](http://html1.mh-extra.com/html/national-instruments/daqcard-dio-24/daqcard-dio-24_user-manual_709163063.webp)
Appendix B
Register-Level Programming
DAQCard-DIO-24 User Manual
B-22
©
National Instruments Corporation
/* EXAMPLE 1*/
wrt(cnfg,0xC0);
/* Port A is in mode 2. */
while (!(rd(portc) & 0x80))
/* Wait until OBFA* is set, indicating */
rd(ireg1);
/* that the data last written to port A has */
/* been read. */
wrt(porta,0x67);
/* Write the data to port A. */
while (!(rd(portc) & 0x20))
/* Wait until IBFA is set, indicating */
rd(ireg1);
/* that data is available in port A to */
/* be read. */
valread = rd(porta);
/* Read data from port A. */
}
Interrupt Programming Examples
The following examples show the process required to enable interrupts
for several different operating modes. The interrupt handling routines
and interrupt installation routines are not included. Also, if you generate
interrupts with the PC3 or PC0 lines of the 82C55A, you must maintain
the active high level until the interrupt service routine is entered.
Otherwise, the host computer considers the interrupt a spurious
interrupt and routes the request to the channel responsible for handling
spurious interrupts. To prevent this problem, try using some other I/O
bit to send feedback to the device generating the interrupt. In this way,
the interrupting device can be signaled that the interrupt service routine
has been entered. For further information on using PC3 and PC0 for
interrupts, see the Interrupt Handling section later in this appendix. The
base address used may not correspond to the base address of the card in
your system. For information on card activation, base addresses, and
interrupt levels, see PC Card Initialization earlier in this appendix.
Main() {
/* Set PC to 1 if you are using a PC, or set MAC to 1 if you are using a
Mac.*/
#define
PC
0
#define
MAC
0
/* If MAC = 1, set base address and define rd and wrt. */
#if
MAC
#define
BASE_ADDRESS
0xa0000000L
#define
rd(a)
((unsigned char) *((unsigned char *) (a)))
#define
wrt(a,d)
(*((unsigned char *) (a)) = ((unsigned char) (d)))
Содержание DAQCard-DIO-24
Страница 68: ...Appendix C OKI 82C55A Data Sheet DAQCard DIO 24 User Manual C 2 National Instruments Corporation ...
Страница 69: ...Appendix C OKI 82C55A Data Sheet National Instruments Corporation C 3 DAQCard DIO 24 User Manual ...
Страница 70: ...Appendix C OKI 82C55A Data Sheet DAQCard DIO 24 User Manual C 4 National Instruments Corporation ...
Страница 71: ...Appendix C OKI 82C55A Data Sheet National Instruments Corporation C 5 DAQCard DIO 24 User Manual ...
Страница 72: ...Appendix C OKI 82C55A Data Sheet DAQCard DIO 24 User Manual C 6 National Instruments Corporation ...
Страница 73: ...Appendix C OKI 82C55A Data Sheet National Instruments Corporation C 7 DAQCard DIO 24 User Manual ...
Страница 74: ...Appendix C OKI 82C55A Data Sheet DAQCard DIO 24 User Manual C 8 National Instruments Corporation ...
Страница 75: ...Appendix C OKI 82C55A Data Sheet National Instruments Corporation C 9 DAQCard DIO 24 User Manual ...
Страница 76: ...Appendix C OKI 82C55A Data Sheet DAQCard DIO 24 User Manual C 10 National Instruments Corporation ...
Страница 77: ...Appendix C OKI 82C55A Data Sheet National Instruments Corporation C 11 DAQCard DIO 24 User Manual ...
Страница 78: ...Appendix C OKI 82C55A Data Sheet DAQCard DIO 24 User Manual C 12 National Instruments Corporation ...
Страница 79: ...Appendix C OKI 82C55A Data Sheet National Instruments Corporation C 13 DAQCard DIO 24 User Manual ...
Страница 80: ...Appendix C OKI 82C55A Data Sheet DAQCard DIO 24 User Manual C 14 National Instruments Corporation ...
Страница 81: ...Appendix C OKI 82C55A Data Sheet National Instruments Corporation C 15 DAQCard DIO 24 User Manual ...
Страница 82: ...Appendix C OKI 82C55A Data Sheet DAQCard DIO 24 User Manual C 16 National Instruments Corporation ...
Страница 83: ...Appendix C OKI 82C55A Data Sheet National Instruments Corporation C 17 DAQCard DIO 24 User Manual ...