Chapter 4
Programming
© National Instruments Corporation
4-49
AT-MIO-16D User Manual
Sample Counts Greater Than 65,536
To program the sample counter for sample counts greater than 65,536, use the following
programming sequence. 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.
a.
Write FF04 to the Am9513A Command Register to select the Counter 4 Mode Register.
b.
Write 1025 to the Am9513A Data Register to store the Counter 4 mode value.
c.
Write FF0C to the Am9513A Command Register to select the Counter 4 Load Register.
d.
Write the least significant 16 bits 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.
e.
Write FF48 to the Am9513A Command Register to load Counter 4.
f.
Write 0 to the Am9513A Data Register to store 0 into the Load Register for Counter 4
reloading.
g.
Write FF28 to the Am9513A Command Register to arm Counter 4.
h.
Write FF05 to the Am9513A Command Register to select the Counter 5 Mode Register.
i.
Write 25 to the Am9513A Data Register to store the Counter 5 mode value.
j.
Write FF0D to the Am9513A Command Register to select the Counter 5 Load Register.
k.
Take the most significant 16 bits of the sample count and do the following:
¥
If the least significant 16 bits of the sample count are all 0 or all 0 except for a 1 in the
least significant bit, write the most significant 16 bits to the Am9513A Data Register to
store the Counter 5 load value.
¥
Otherwise, add 1 to the most significant 16 bits of the sample count and write that value
to the Am9513A Data Register to store the Counter 5 load value.
l.
Write FF70 to the Am9513A Command Register to load and arm Counter 5.
m. Set the 16*/32 CNT 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 acquisition operation is terminated when both Counters 4 and 5 reach
zero.
4. Clear the A/D circuitry.
Before you start the data acquisition operation, you must empty the A/D FIFO to clear out any
old A/D conversion results. This emptying must be done after the counters are programmed in
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: ......