Appendix E
Register-Level Programming
© National Instruments Corporation
E-29
Lab-PC+ User Manual
Programming Example
Example 1. Configure Port A as an input port in Mode 1:
•
Write B0 (hex) to the Digital Control Register.
•
Wait for bit 5 of Port C (IBFA) to be set, indicating that data has been latched into Port A.
•
Read data from Port A.
Example 2. Configure Port B as an input port in Mode 1:
•
Write 86 (hex) to the Digital Control Register.
•
Wait for bit 1 of Port C (IBFB) to be set, indicating that data has been latched into Port B.
•
Read data from Port B.
Output
The control word written to the Digital Control Register to configure Port A for output in Mode 1
is shown here. Bits PC4 and PC5 of Port C can be used as extra input or output lines when Port
A uses Mode 1 output.
Port C bits PC4 and PC5
1 = input
0 = output
1
0
X
X
X
0
1/0
1
7
6
5
4
3
2
1
0
The control word written to the Digital Control Register to configure Port B for output in Mode 1
is shown here. Notice that Port B is not provided with extra input or output lines from Port C.
1
X
0
X
X
X
1
X
7
6
5
4
3
2
1
0
During a Mode 1 data write transfer, the status of the handshaking lines and interrupt signals can
be obtained by reading Port C. Notice that the bit definitions are different for a write and a read
transfer.
Содержание Low-Cost Multifunction I/O Board for ISA...
Страница 89: ......
Страница 90: ......
Страница 91: ......
Страница 92: ......
Страница 93: ......
Страница 94: ......
Страница 95: ......
Страница 96: ......
Страница 97: ......
Страница 98: ......
Страница 99: ......
Страница 101: ......
Страница 102: ......
Страница 103: ......
Страница 104: ......
Страница 105: ......
Страница 106: ......
Страница 107: ......
Страница 108: ......
Страница 109: ......
Страница 110: ......
Страница 111: ......
Страница 112: ......
Страница 113: ......
Страница 114: ......
Страница 115: ......
Страница 116: ......