beautypg.com

National Instruments AT-MIO-16X User Manual

Page 188

background image

Chapter 5

Programming

© National Instruments Corporation

5-19

AT-MIO-16X User Manual

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 16 LSBs of the sample count value minus 1 to the
Am9513A Data Register to store the Counter 4 load value.

If the 16 LSBs are all 0, write FFFF.

5.

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

6.

Write 0 to the Am9513A Data Register to store 0 into the Load
Register for Counter 4 reloading.

7.

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

8.

Write FF05 to the Am9513A Command Register to select the
Counter 5 Mode Register.

9.

Write 25 to the Am9513A Data Register to store the Counter 5
mode value.

10. Write FF0D to the Am9513A Command Register to select the

Counter 5 Load Register.

11. Take the 16 MSBs of the sample count and complete the following

steps:

If the 16 LSBs of the sample count are all 0 or all 0 except for
a 1 in the LSB, write the 16 MSBs to the Am9513A Data
Register to store the Counter 5 load value.

Otherwise, add 1 to the 16 MSBs of the sample count and write
that value to the Am9513A Data Register to store the Counter 5
load value.

12. Write FF70 to the Am9513A Command Register to load and arm

Counter 5.

13. Set the CNT32/16* bit in Command Register 1 to notify the

hardware that both Counters 4 and 5 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
Counter 5 decrements every time Counter 4 reaches zero. The data