Appendix E Register-Level Programming
© National Instruments Corporation E-31 Lab-PC+ User Manual
Programming Example
Example 1. Configure Port A as an output port in Mode 1:
Write A0 (hex) to the Digital Control Register.
Wait for bit 7 of Port C (OBFA*) to be cleared, indicating that the data last written to Port A
has been read.
Write new data to Port A.
Example 2. Configure Port B as an output port in Mode 1:
Write 84 (hex) to the Digital Control Register.
Wait for bit 1 of Port C (OBFB*) to be cleared, indicating that the data last written to Port B
has been read.
Write new data to Port A.
Mode 2
This mode is for communication over a bidirectional 8-bit bus. Handshake signals can be used in
a manner similar to Mode 1. Interrupt generation and enable/disable functions are also available.
Other features of this mode include the following:
Used in Group A only (Port A and upper nibble of Port C).
One 8-bit bidirectional port (Port A) and a 5-bit control status port (Port C).
Both inputs and outputs are latched.
Control Words
In Mode 2, an 8-bit bus can be used for both input and output transfers without changing the
configuration. The data transfers are synchronized with handshaking lines in Port C. This mode
uses only Port A; however, Port B can be used in either Mode 0 or Mode 1 while Port A is
configured for Mode 2.
The control word written to the Digital Control Register to configure Port A as a bidirectional
data bus in Mode 2 is shown below. Because Mode 2 is for Port A only, Port B can be
programmed to operate in Mode 0 or Mode 1. If Port B is configured for Mode 0, then PC2,
PC1, and PC0 of Port C can be used as extra input or output lines.