I have a PCIE-6363 and I need to create a task (or two) that can measure the times that all rising edges on two channels occur over the course of ten seconds with the highest possible degree of accuracy. There could be somewhere around 100 events in the ten second period across two channels and I need to know precisely when each one happened relative to when the first one occurs on the first channel.
Solved! Go to Solution.
If you have good sharp digital signals, the best timing resolution will come with 2 sync'ed counter tasks. To sync them, you need both configured to use an "Arm Start" trigger which is distinct from a regular Start trigger. I like to trigger them off something like PFI0 which I can then control with a simple, software timed DIO task for port1/line0. (Both of these designations refer to the same physical pin. When you toggle port1/line0 from low to high, your counter tasks can see it as a rising edge Arm Start trigger.)
1. Configure both counter tasks for edge counting. Configure both to count edges of the 100 MHz internal timebase.
2. Include DAQmx Timing to make them buffered tasks. You'll also need to do some further configuration with a DAQmx Timing property node. Here you need to specify that the signals you want to measure will act as the sample clocks. I'm not near a LV machine and can't recall the exact syntax to look for.
3. Use a DAQmx Trigger property node to configure an Arm Start trigger. You need to also designate that it's a Digital Edge trigger and specify that it's coming from PFI0.
4. Configure a simple DO task for port1/line0. Start it and then write a "False" to set the state low.
5. After setting the DO state low, start both counter tasks
6. Then toggle the DO state high to trigger the counter tasks and let them start accumulating measurements. I'd toggle it back low too though it won't really matter for a 1-time run of this particular task.
7. After your 10 seconds have elapsed, read all samples from both tasks. Read them as U32 raw count values.
8. Both data sets have the same t=0 point when you generated your trigger edge. All the measurement data will be "timestamps" of when the signal edges occurred. The units for these timestamps are "# cycles of the 100 MHz timebase" or "# of 10 nanosec intervals".
This somewhat convoluted method is the workaround needed to capture a timestamp for the 1st edge after the trigger with an X-series board, an issue I've griped about before. Prior generations of counters could have been configured to do this with a simpler period measurement task.
Thanks, that works beautifully. The old traditional DAQ code that I was replacing seemed much more straightforward, but this is giving me the same results.
Since I wanted the time reported to be relative to the first rising edge on one of the channels I just triggered both of the tasks from the same input channel and prepended zero to the counter values read on that channel.