So every 4 msec you get a trigger signal that should initiate a 2 msec acquisition (1000 samples at 500 kHz sampling rate)?
There's an example of a way to use your board's counters to support retriggered analog acquisition here on the NI site:
Retriggered Analog Input Example. The code may look a little complicated, but the basic idea is described pretty well.
The goal is to make sure the timing is handled in hardware so you don't miss triggers while doing the software reprogramming. AI Start would be called only one time prior to your loop, and only AI Read would be calle
d inside the loop.
Just be careful about your timestamp info. The analog acq. task won't have any "awareness" of time intervals between samples. It'll be up to you to slice up the data into appropriate chunks. You can probably do this by simply requesting the right number (1000) from AI Read.
Good luck,
-Kevin P.
CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).