
Programming
Chapter 4
AT-MIO-16D User Manual
4-52
© National Instruments Corporation
2. Program the sample-interval counter.
Use Counter 3 of the Am9513A Counter/Timer as the sample-interval counter. Counter 3 can be
programmed to generate a pulse once every N counts. N is referred to as the sample interval, that
is, the time between successive A/D conversions. N can be between 2 and 65,536. One count is
equal to the period of the timebase clock used by the counter. The following clocks are available
internal to the Am9513A: 1 MHz, 100 kHz, 10 kHz, 1 kHz, and 100 Hz. In addition, the
sample-interval timer can use signals connected to any of the Am9513A SOURCE input pins.
To program the sample-interval counter, use the following programming sequence. All writes
are 16-bit operations. All values given are hexadecimal.
a. Write FF03 to the Am9513A Command Register to select the Counter 3 Mode Register.
b. Write the mode value to the Am9513A Data Register to store the Counter 3 mode value. Use
one of the following mode values:
8B25 – Selects 1-MHz clock
8C25 – Selects 100-kHz clock
8D25
–
Selects 10-kHz clock
8E25 – Selects 1-kHz clock
8F25 – Selects 100-Hz clock
8525 – Selects signal at SOURCE5 input as clock (counts the rising edge of the signal,
6 MHz maximum)
c. Write FF0B to the Am9513A Command Register to select the Counter 3 Load Register.
d. Write 2 to the Am9513A Data Register to store the Counter 3 load value.
e. Write FF44 to the Am9513A Command Register to load Counter 3.
f.
Write FFF3 to the Am9513A Command Register to step Counter 3 down to one.
g. Write the desired sample interval to the Am9513A Data Register to store the Counter 3 load
value:
•
If the sample interval is between 2 and FFFF (65,535 decimal) inclusive, write the sample
interval to the Am9513A Data Register.
•
If the sample interval is 10000 (65,536 decimal), write 0 to the Am9513A Data Register.
h. Write FF24 to the Am9513A Command Register to arm Counter 3.
After you complete this programming sequence, Counter 3 is configured to generate A/D
conversion pulses as soon as you enable it by applying a trigger.
3. Program the sample counter.
Counters 4 and 5 of the Am9513A Counter/Timer are used as the sample counter. The sample
counter tallies the number of A/D conversions initiated by Counter 3 and stops Counter 3 when
the desired sample count is reached. If the desired sample count is 65,536 or less, only Counter 4
needs to be used, making Counter 5 available for general-purpose timing applications. If the
desired sample count is greater than 65,536, both Counters 4 and 5 must be used.
Summary of Contents for AT-MIO-16D
Page 16: ......
Page 23: ......
Page 185: ......
Page 206: ......
Page 207: ......
Page 208: ......
Page 209: ......
Page 210: ......
Page 211: ......
Page 212: ......
Page 213: ......
Page 214: ......
Page 215: ......
Page 216: ......
Page 217: ......
Page 218: ......
Page 219: ......
Page 220: ......
Page 221: ......
Page 222: ......
Page 223: ......
Page 224: ......
Page 225: ......
Page 226: ......
Page 227: ......
Page 228: ......
Page 229: ......
Page 230: ......
Page 231: ......
Page 232: ......
Page 233: ......
Page 234: ......
Page 235: ......
Page 236: ......
Page 237: ......
Page 238: ......
Page 239: ......
Page 240: ......
Page 241: ......
Page 242: ......
Page 243: ......
Page 244: ......
Page 246: ......
Page 247: ......
Page 248: ......
Page 249: ......
Page 250: ......
Page 251: ......
Page 252: ......
Page 253: ......
Page 254: ......
Page 255: ......
Page 256: ......
Page 257: ......
Page 258: ......
Page 259: ......
Page 260: ......
Page 261: ......