Chris,
I took your vi and made up an example for a single channel of timestamping. There's one main vi for performing the timestamping and another one that generates simulated photon pulses to be timestamped. It worked on my lab PC with a 6602, but note that all the default values assume that the 6602 is Device 2. Here are some notes in no particular order:
1. The timestamper is setup to start on a digital trigger. In this example program, that digital trigger is a real hardware signal that's generated by a Digital Output task when you select the "Trigger Now" button.
2. This is a buffered task so
every photon pulse will get timestamped.
3. I chose to illustrate 2 different concepts that can help to keep your Data Acq loop responsive even while doing file writing. The first concept is
not to simply request a bunch of samples from DAQmx Read. Instead, I first query to find out how many samples are available. I only read and process them
after they're sure to be available. This way the Data Acq loop doesn't freeze up for a second or two while waiting for DAQmx Read to retrieve data.
The second concept is to send the data off to an independent loop for processing (graphing, calculations, file writing, etc.). Here, I wrote the timestamp data and rollover information to a queue. A separate loop reads from the queue and performs all the real work on the data. If file writes start bogging down, all the timestamp data just builds up in the queue for a while.
4. The example isn't complete. I put in text comments about the kinds of things you'd need to add. Such as the actual file writing. Also, a little bit of processing to handle the rollover cleanly.
5. Note that I purposely chose to use doubles for the timestamps -- this will allow you to store larger values than a u32 after accounting for the # of rollovers.
6. The vi that simulates photon pulses is just a pulse train generator. Note that you can update the frequency on the fly. Each time you change the freq value, the actual pulse train will also change freq without stopping.
7. Eventually you want to do this with 8 channels? Be aware that there are only 3 DMA "pipelines" available for handling fast photon pulses. The other 5 would need to be explicitly configured to do their data transfers with interrupts. If your detectors are firing "fast" (a few kHz or more), you probably won't be able to keep up. The exact capability is system (and program) dependent, but it is definitely a limitation.
One possible workaround is to get 2 more 6602's because each card gives you 3 DMA "pipelines".
Good luck!
-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.