![background image](http://html1.mh-extra.com/html/national-instruments/daqcard-dio-24/daqcard-dio-24_user-manual_709163051.webp)
Appendix B
Register-Level Programming
DAQCard-DIO-24 User Manual
B-10
©
National Instruments Corporation
Mode 0 Programming Example
The following example shows how to configure the 82C55A for various
combinations of mode 0 input and output. This code is strictly an
example and is not intended to be used without modification in a
practical situation. The base address used may not correspond to the
base address of the card in your system. For information on card
activation, base addressing, 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)))
11
10010011
Input
Output
Input
Input
12
10011000
Input
Input
Output
Output
13
10011001
Input
Input
Output
Input
14
10011010
Input
Input
Input
Output
15
10011011
Input
Input
Input
Input
Table B-3.
Mode 0 I/O Configurations (Continued)
Control Word Bit
Group A
Group B
Number
76543210
Port A
Port C
Port B
1
Port C
2
1
Upper nibble of port C
2
Lower nibble of port C