Programming
Chapter 4
AT-MIO-16D User Manual
4-82
© National Instruments Corporation
/* EXAMPLE 1*/
outp(cnfg,0x80);
/* Ports A, B, and C are outputs. */
outp(porta,0x12);
/* Write data to Port A. */
outp(portb,0x34);
/* Write data to Port B. */
outp(portc,0x56);
/* Write data to Port C. */
/* EXAMPLE 2*/
outp(cnfg,0x90);
/* Port A is input; Ports B and C are
outputs. */
outp(portb,0x22);
/* Write data to Port B. */
outp(portc,0x55);
/* Write data to Port C. */
valread = inp(porta);
/* Read data from Port A. */
/* EXAMPLE 3 */
outp(cnfg,0x82);
/* Ports A and C are outputs; Port B
is an input. */
/* EXAMPLE 4 */
outp(cnfg,0x89);
/* Ports A and B are outputs; Port C
is an input. */
}
Mode 1–Strobed Input
Mode 1 transfers data that is synchronized by handshaking signals. Ports A and B use the eight
lines of Port C to generate or receive the handshake signals. This mode divides the ports into
two groups (Group A and Group B):
•
Each group contains one 8-bit data port (Port A or Port B) and one 4-bit control/data port
(upper or lower nibble of Port C).
•
The 8-bit data ports can be either input or output, both of which are latched.
•
The 4-bit ports are used for control and status of the 8-bit data ports.
•
The transfer of data is synchronized by handshaking signals in the 4-bit port.
•
Interrupt generation and enable and/or disable functions are available.
The control word written to the DIO-24 CNFG Register to configure Port A for input in Mode 1
is shown as follows. Bits PC6 and PC7 of Port C can be used as extra input or output lines.
Port C bits PC6 and PC7
1 = input
0 = output
7
6
5
4
3
2
1
0
1
0
X
X
X
1
1/0
1
Содержание AT-MIO-16D
Страница 16: ......
Страница 23: ......
Страница 185: ......
Страница 206: ......
Страница 207: ......
Страница 208: ......
Страница 209: ......
Страница 210: ......
Страница 211: ......
Страница 212: ......
Страница 213: ......
Страница 214: ......
Страница 215: ......
Страница 216: ......
Страница 217: ......
Страница 218: ......
Страница 219: ......
Страница 220: ......
Страница 221: ......
Страница 222: ......
Страница 223: ......
Страница 224: ......
Страница 225: ......
Страница 226: ......
Страница 227: ......
Страница 228: ......
Страница 229: ......
Страница 230: ......
Страница 231: ......
Страница 232: ......
Страница 233: ......
Страница 234: ......
Страница 235: ......
Страница 236: ......
Страница 237: ......
Страница 238: ......
Страница 239: ......
Страница 240: ......
Страница 241: ......
Страница 242: ......
Страница 243: ......
Страница 244: ......
Страница 246: ......
Страница 247: ......
Страница 248: ......
Страница 249: ......
Страница 250: ......
Страница 251: ......
Страница 252: ......
Страница 253: ......
Страница 254: ......
Страница 255: ......
Страница 256: ......
Страница 257: ......
Страница 258: ......
Страница 259: ......
Страница 260: ......
Страница 261: ......