
Chapter 4
Programming
© National Instruments Corporation
4-13
PC-TIO-10 User Manual
Interrupt Programming Example for the MC6821
The PC-TIO-10 is configured so that EXTIRQ1 on the I/O connector is connected to CA1 on the
MC6821, EXTIRQ2 on the I/O connector is connected to CB1 on the MC6821, and CA2 and
CB2 of the MC6821 are disabled. The signal names CA1, CA2, CB1, and CB2 refer to the
names of pins located on the MC6821. The names are given to clarify how the interrupt circuitry
is connected on the MC6821. For more information on these signals, see Appendix D, Motorola
MC6821 Data Sheet. Interrupts are enabled and disabled through the MC6821 Control Register.
In addition, the edge that generates the interrupt is programmable through the MC6821 Control
Register.
When an interrupt is generated (as indicated when the Control Register is read), the only way the
interrupt can be cleared is by reading the Output Register (through the Data Register) of the I/O
port that indicated the interrupt. For instance, if IRQ in the Port B Control Register is set, you
must set DRS of the Port B Control Register to one, and then you must read the Port B Data
Register. The data returned may not be important depending on how you are using interrupts.
The code that follows demonstrates how to set up the MC6821 for interrupt generation.
/* defines for the program */
#define base_address 0x01A0 /* board located at address 1A0 */
#define porta_offset 0x04 /* offset for Port A */
#define portb_offset 0x06 /* offset for Port B */
#define data_offset 0x00 /* offset of Data Register */
#define ctrl_offset 0x01 /* offset of Control Register */
#define irq_channel 5 /* the interrupt channel set on W1 */
/* a sample structure for the interrupt service routine */
typedef struct { unsigned int pa_ctrl,
pa_data,
pb_ctrl,
pb_data;
int done;
} isr_block_type;
/* prototypes for the assembly language functions */
void far install_isr(int, isr_block_type far *);
void far remove_isr(void);
/* the main program */
void main()
{ unsigned int pa_ctrl,
pa_data,
pb_ctrl,
pb_data;
isr_block_type isr_block;
/* calculate register addresses */
Содержание 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 ...