![background image](http://html1.mh-extra.com/html/national-instruments/daqcard-dio-24/daqcard-dio-24_user-manual_709163056.webp)
Appendix B
Register-Level Programming
©
National Instruments Corporation
B-15
DAQCard-DIO-24 User Manual
/* EXAMPLE 1–Port A input */
wrt(cnfg,0xB0);
/* Port A is an input in mode 1. */
while (!(rd(portc) & 0x20))
/* Wait until IBFA is set, indicating that */
rd(ireg1);
/* data has been loaded in port A. */
valread = rd(porta);
/* Read the data from port A. */
/* EXAMPLE 2–Port B input */
wrt(cnfg,0x86);
/* Port B is an input in mode 1. */
while (!(rd(portc) & 0x02))
/* Wait until IBFB is set, indicating that */
rd(ireg1);
/* data has been loaded in port B. */
valread = rd(portb);
}
Mode 1 Strobed Output
The control word written to the CNFG Register to configure port A for
output in mode 1 is shown as follows. Bits PC4 and PC5 of port C can
be used as extra input or output lines when port A uses mode 1 output.
The control word written to the CNFG Register to configure port B for
output in mode 1 is shown as follows.
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.
X
X
X
1/0
0
1
0
1
Port C bits PC4 and PC5
1 = input
0 = output
7
6
5
4
3
2
1
0
X
1
X
X
X
X
1
7
6
5
4
3
2
1
0
0