beautypg.com

National Instruments PC-LPM-16/PnP User Manual

Page 105

background image

Appendix D Register-Level Programming

National Instruments Corporation

D-33

PC-LPM-16/PnP User Manual

Programming Multiple A/D Conversions Using External Timing

You can use the external timing signal EXTCONV* for multiple A/D
conversions. A low-to-high transition of EXTCONV* initiates an A/D
conversion. Software can also initiate a data acquisition operation.
Setting the DISABDAQ bit in Command Register 2 disables the
EXTCONV* signal. Clearing the DISABDAQ bit in Command
Register 2 enables the EXTCONV* signal and starts the data
acquisition operation. To use the EXTCONV* signal, the OUT0 of
counter 0 must be driven high. Otherwise, EXTCONV* is disabled.

Each of these programming steps is explained as follows:

1.

Disable the A/D conversion.

Writing 2 to Command Register 2 to set the DISABDAQ bit
disables the A/D conversion. The pulse on the EXTCONV* line is
ignored.

2.

Program counter 0.

High output of counter 0 enables the EXTCONV* signal. Write 34
to the Counter Mode Register to force OUT0 high (enable
EXTCONV*). Writing 30 to the Counter Mode Register forces
OUT0 low, which disables the EXTCONV* and stops the data
acquisition operation.

3.

Select the analog input channel.

Write to Command Register 1 to select the analog input channel.
The SCANEN* bit must be set for data acquisition operation on a
single channel. See Command Register 1 bit descriptions earlier in
this appendix for analog input channel bit descriptions.

4.

Clear the A/D circuitry.

Before starting the data acquisition operation, empty the A/D FIFO
to clear any old A/D conversion results. Write 0 to the A/D Clear
Register and read the A/D FIFO Low- and High-Byte registers to
empty the FIFO. Ignore the data.

5.

Start and service the data acquisition operation.

Clear the DISABDAQ bit in Command Register 2 to start the data
acquisition sequence.

a.

Write 0 to Command Register 2 to enable the A/D conversion.

b.

The next EXTCONV* signal initiates an A/D conversion. The
operation must be serviced by reading the A/D FIFO Register
every time an A/D conversion result becomes available. To

a.Book : l.Appendix D Page 33 Wednesday, November 20, 1996 6:36 PM