Programming
Chapter 4
AT-MIO-16D User Manual
4-86
© National Instruments Corporation
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.
OBFA*
PC7
PC6
PC5
PC4
PC3
PC2
PC1
PC0
I/O
INTRA
ACKB*
OBFB*
INTRB
I/O
Group A
Group B
ACKA*
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_A PORTAoffset;
portb = BASE_A PORTBoffset;
portc = BASE_A PORTCoffset;
cnfg = BASE_A 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. */
}
Summary of Contents for AT-MIO-16D
Page 16: ......
Page 23: ......
Page 185: ......
Page 206: ......
Page 207: ......
Page 208: ......
Page 209: ......
Page 210: ......
Page 211: ......
Page 212: ......
Page 213: ......
Page 214: ......
Page 215: ......
Page 216: ......
Page 217: ......
Page 218: ......
Page 219: ......
Page 220: ......
Page 221: ......
Page 222: ......
Page 223: ......
Page 224: ......
Page 225: ......
Page 226: ......
Page 227: ......
Page 228: ......
Page 229: ......
Page 230: ......
Page 231: ......
Page 232: ......
Page 233: ......
Page 234: ......
Page 235: ......
Page 236: ......
Page 237: ......
Page 238: ......
Page 239: ......
Page 240: ......
Page 241: ......
Page 242: ......
Page 243: ......
Page 244: ......
Page 246: ......
Page 247: ......
Page 248: ......
Page 249: ......
Page 250: ......
Page 251: ......
Page 252: ......
Page 253: ......
Page 254: ......
Page 255: ......
Page 256: ......
Page 257: ......
Page 258: ......
Page 259: ......
Page 260: ......
Page 261: ......