Chapter 4 Register-Level Programming
© National Instruments Corporation 4-11 PC-DIO-24 User Manual
At the digital I/O connector, port C has the following pin assignments when in mode 1 output.Notice that the status of ACKA* and ACKB* is not included when port C is read.
PC7
PC6
PC5
PC4
PC3
PC2
PC1
PC0
OBFA*
ACKA*
I/O
I/O
INTRA
ACKB*
OBFB*
INTRB
Group A
Group B
Mode 1 Output Programming Example
Main() {
#define BASE_ADDRESS 0x210 /* Board located at address 210. */
#define PORTAoffset 0x00 /* Offset for port A */
#define PORTBoffset 0x01 /* Offset for port B */
#define PORTCoffset 0x02 /* Offset for port C */
#define CNFGoffset 0x03 /* Offset for CNFG */
register unsigned int porta, portb, portc, cnfg;
char valread; /* Variable to store data read from a
port */
/* Calculate register addresses. */
porta = BASE_ADDRESS + PORTAoffset;
portb = BASE_ADDRESS + PORTBoffset;
portc = BASE_ADDRESS + PORTCoffset;
cnfg = BASE_ADDRESS + CNFGoffset;
/* EXAMPLE 1–port A output */
outp(cnfg,0xA0); /* Port A is an output in mode 1.*/
while (!(inp(portc) & 0x80)); /* Wait until OBFA* is set, indicating
that the data last written to port A
has been read.*/
outp(porta,0x12); /* Write data to port A. */
/* EXAMPLE 2–port B output */
outp(cnfg,0x84); /* Port B is an output in mode 1.*/
while (!(inp(portc) & 0x02)); /* Wait until OBFB* is set, indicating
that the data last written to port B
has been read.*/
outp(portb,0x34); /* Write the data to port B. */
}