
Programming
Chapter 4
PC-TIO-10 User Manual
4-14
© National Instruments Corporation
pa_ctrl = base_a porta_ ctrl_offset;
pa_data = base_a porta_ data_offset;
pb_ctrl = base_a portb_ ctrl_offset;
pb_data = base_a portb_ data_offset;
/* clear any active interrupts by reading Data Registers */
outp(pa_ctrl, 0x04); /* select Output Register */
inp(pa_data); /* clear Port A interrupts */
outp(pb_ctrl, 0x04); /* select Output Register */
inp(pb_data); /* clear Port B interrupts */
/* install the interrupt service routine */
isr_block.pa_ctrl = pa_ctrl; /* initialize isr_block */
isr_block.pa_data = pa_data;
isr_block.pb_ctrl = pb_ctrl;
isr_block.pb_data = pb_data;
isr_block.done = 0;
install_isr(irq_channel, &isr_block);
/* configure Ports A and B for interrupts */
outp(pa_ctrl, 0x05); /* enable falling-edge interrupts */
outp(pb_ctrl, 0x07); /* enable rising-edge interrupts */
/* wait for the process to be completed */
while (!isr_block.done)
/* call_foreground_code() */ ;
/* disable interrupts and remove the interrupt service routine */
outp(pa_ctrl, 0x04);
inp(pa_data);
outp(pb_ctrl, 0x04);
inp(pb_data);
remove_isr();
}
Sample code for the functions
install_isr()
and
remove_isr()
is presented as follows. Be
sure to pass a 32-bit structure pointer to the
install_isr()
function, because the main
program's data will probably be stored in a different memory segment than the one where the
interrupt functions are located. In addition, if you call the installation function from a language
besides C, make sure the parameters are passed in the proper order. C pushes parameters on the
stack from right to left, but most other languages, most notably Pascal, push parameters from left
to right. Finally, be sure to make the calls to the functions using 32-bit addresses, because all of
the code assumes data is offset with respect to a 32-bit return address. The code can be modified
to use 16-bit addresses by changing
far
to
near
and decrementing all references to the base page
register,
bp
, by two in
install_isr()
and
remove_isr()
only. Do not modify
isr_handler()
.
Содержание PC-TIO-10
Страница 57: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 2 National Instruments Corporation ...
Страница 58: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 3 PC TIO 10 User Manual ...
Страница 59: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 4 National Instruments Corporation ...
Страница 60: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 5 PC TIO 10 User Manual ...
Страница 61: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 6 National Instruments Corporation ...
Страница 62: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 7 PC TIO 10 User Manual ...
Страница 63: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 8 National Instruments Corporation ...
Страница 64: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 9 PC TIO 10 User Manual ...
Страница 65: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 10 National Instruments Corporation ...
Страница 66: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 11 PC TIO 10 User Manual ...
Страница 67: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 12 National Instruments Corporation ...
Страница 68: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 13 PC TIO 10 User Manual ...
Страница 69: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 14 National Instruments Corporation ...
Страница 70: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 15 PC TIO 10 User Manual ...
Страница 71: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 16 National Instruments Corporation ...
Страница 72: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 17 PC TIO 10 User Manual ...
Страница 73: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 18 National Instruments Corporation ...
Страница 74: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 19 PC TIO 10 User Manual ...
Страница 75: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 20 National Instruments Corporation ...
Страница 76: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 21 PC TIO 10 User Manual ...
Страница 77: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 22 National Instruments Corporation ...
Страница 78: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 23 PC TIO 10 User Manual ...
Страница 79: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 24 National Instruments Corporation ...
Страница 80: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 25 PC TIO 10 User Manual ...
Страница 81: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 26 National Instruments Corporation ...
Страница 82: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 27 PC TIO 10 User Manual ...
Страница 83: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 28 National Instruments Corporation ...
Страница 84: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 29 PC TIO 10 User Manual ...
Страница 85: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 30 National Instruments Corporation ...
Страница 86: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 31 PC TIO 10 User Manual ...
Страница 87: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 32 National Instruments Corporation ...
Страница 88: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 33 PC TIO 10 User Manual ...
Страница 89: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 34 National Instruments Corporation ...
Страница 90: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 35 PC TIO 10 User Manual ...
Страница 91: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 36 National Instruments Corporation ...
Страница 92: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 37 PC TIO 10 User Manual ...
Страница 93: ...AMD Am9513A Data Sheet Appendix C PC TIO 10 User Manual C 38 National Instruments Corporation ...
Страница 94: ...Appendix C AMD Am9513A Data Sheet National Instruments Corporation C 39 PC TIO 10 User Manual ...
Страница 96: ...Motorola MC6821 Data Sheet Appendix D PC TIO 10 User Manual D 2 National Instruments Corporation ...
Страница 97: ...Appendix D Motorola MC6821 Data Sheet National Instruments Corporation D 3 PC TIO 10 User Manual ...
Страница 98: ...Motorola MC6821 Data Sheet Appendix D PC TIO 10 User Manual D 4 National Instruments Corporation ...
Страница 99: ...Appendix D Motorola MC6821 Data Sheet National Instruments Corporation D 5 PC TIO 10 User Manual ...
Страница 100: ...Motorola MC6821 Data Sheet Appendix D PC TIO 10 User Manual D 6 National Instruments Corporation ...
Страница 101: ...Appendix D Motorola MC6821 Data Sheet National Instruments Corporation D 7 PC TIO 10 User Manual ...
Страница 102: ...Motorola MC6821 Data Sheet Appendix D PC TIO 10 User Manual D 8 National Instruments Corporation ...
Страница 103: ...Appendix D Motorola MC6821 Data Sheet National Instruments Corporation D 9 PC TIO 10 User Manual ...
Страница 104: ...Motorola MC6821 Data Sheet Appendix D PC TIO 10 User Manual D 10 National Instruments Corporation ...
Страница 105: ...Appendix D Motorola MC6821 Data Sheet National Instruments Corporation D 11 PC TIO 10 User Manual ...
Страница 106: ...Motorola MC6821 Data Sheet Appendix D PC TIO 10 User Manual D 12 National Instruments Corporation ...