beautypg.com

Sample counts 2 through 65,536, Sample counts greater than 65,536 – National Instruments AT-MIO-16X User Manual

Page 187

background image

Chapter 5

Programming

AT-MIO-16X User Manual

5-18

© National Instruments Corporation

Sample Counts 2 through 65,536

Use the following programming sequence to program the sample
counter for sample counts up to 65,536. The minimum permitted sample
count is 2. All writes are 16-bit operations. All values given are
hexadecimal.

1.

Write FF04 to the Am9513A Command Register to select the
Counter 4 Mode Register.

2.

Write 1025 to the Am9513A Data Register to store the Counter 4
mode value for posttrigger acquisition modes. Write 9025 to the
Am9513A Data Register to store the Counter 4 mode value for
pretrigger acquisition modes.

3.

Write FF0C to the Am9513A Command Register to select the
Counter 4 Load Register.

4.

Write the sample count value to the Am9513A Data Register to
store the Counter 4 load value:

If the sample count is between 2 and FFFF (65,535 decimal),
write the sample count to the Am9513A Data Register.

If the sample count is 10000 (65,536 decimal), write 0 to the
Am9513A Data Register.

5.

Write FF48 to the Am9513A Command Register to load Counter 4.

6.

Write FFF4 to the Am9513A Command Register to decrement
Counter 4.

7.

Write FF28 to the Am9513A Command Register to arm Counter 4.

8.

Clear the CNT32/16* bit in Command Register 1 to notify the
hardware that only Counter 4 will be used as the sample counter.

After you complete this programming sequence, Counter 4 is
configured to count A/D conversion pulses generated by Counter 3 and
turns off the data acquisition operation when Counter 4 decrements to
zero.

Sample Counts Greater than 65,536

To program the sample counter for sample counts greater than 65,536,
use the following programming sequence to concatenate Counter 4 to
Counter 5. The lower 16 bits of the sample count are stored in Counter
4, and the upper 16 bits of the sample count are stored in Counter 5. All
writes are 16-bit operations. All values given are hexadecimal.