Appendix B
Register-Level Programming
©
National Instruments Corporation
B-17
DAQCard-DIO-24 User Manual
Figure B-3.
Port C Pin Assignments in Mode 1 Output
Mode 1 Output Programming Example
The following example shows how to configure the 82C55A for various
combinations of mode 1 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)))
/* Else if PC = 1, set base address and define rd and wrt. */
#elif
PC
#define
BASE_ADDRESS
0x0220
#define
rd(a)
((unsigned char) inp(((unsigned int) (a))))
#define
wrt(a,d)
(outp(((unsigned int) (a)), ((unsigned char) (d))))
#end
PC7
PC6
PC5
PC4
PC3
PC2
PC1
PC0
OBFA*
ACKA*
I/O
I/O
INTRA
ACKB*
OBFB*
INTRB
Group A
Group B