Register-Level Programming Chapter 4
Lab-NB User Manual 4-44 © National Instruments Corporation
c. Write the most significant byte of the timebase count to the Counter B Data Register. For
example, programming a timebase of 10 µsec requires a timebase count of
10 µsec
0.5 µsec
= 20 µsec
3. Program count er A0 to force OUT0 high.
Counter A0 of the 8253(A) Counter/Timer is used as the sample-interval counter. A high-to-low
transition on OUT0 (counter A0 output) initiates a conversion. Counter A0 can be programmed
to generate a pulse once every N µsec. N is referred to as the sample interval, that is, the time
between successive A/D conversions. N can be between 2 and 65,535. The sample interval is
equal to the period of the timebase clock used by counter A0 multiplied by N. A 1-MHz clock is
internally connected to CLK0 (the clock used by counter A0).
Write 34 (hex) to the Counter A Mode Register (select counter A0, mode 2) to force OUT0 to a
high state prior to clearing the A/D FIFO. This is an 8-bit write operation.
4. Clear the A/D circuitry.
Before you start the DAQ operation, the A/D FIFO must be emptied in order to clear out any old
A/D conversion results. Empty the A/D FIFO after the counters are programmed because
programming the counters can cause spurious edges. Write 0 to the A/D Clear Register to empty
the FIFO (8-bit write), followed by a read from the A/D FIFO (8-bit read). Ignore the data
obtained in the read.
5. Program counter A1 to force OUT1 low.
Counter A1 must be programmed so that OUT1 is at logic low state.
a. Write 70 (hex) to the Counter A Mode Register. This forces OUT1 low.
6. Program the sample-interval counter (counter A0).
Use the following programming sequence to program counter A0, the sample-interval counter.
All writes are 8-bit write operations. All values given are hexadecimal.
a. Write 34 to the Counter A Mode Register (select counter A0, mode 2).
b. Write the least significant byte of the sample interval to the Counter A0 Data Register.
c. Write the most significant byte of the sample interval to the Counter A0 Data Register.