05-14-2019 08:24 AM
Hello
I'm need to acquire analog inputs and counter data from an linear quadrature encoder synchronous by a reference trigger.
I have successfully realized a synchronous but continuous acquisiton of the analog input and the counter as well as a triggered (referencetrigger) acquisistion of only analog inputs. But I struggle with the combination of both.
Is it even possible to acquire analog and counter data synchronous by a reference trigger? If yes do you have any examples, reference for me?
I am using the DAQmx driver and have a NI PXIe-1073 as chassis with a NI PXIe-6363 module installed.
Thanks and best regards,
Matthias
05-14-2019 10:22 AM
I don't believe that counter tasks support reference triggers, at least not on NI's common MIO board families (including the X-series 6363 you have). However, it's also likely there's a *different* way to use the board's counters to solve your sync issue.
One possibility: configure the encoder task to "borrow" the AI task's sample clock (one of the parameters available when configuring task timing). Configure a 2nd counter to count AI sample clocks and to use the reference trigger signal as its own sample clock. Start both counter tasks before AI. As you collect and accumulate continuous encoder data, the 2nd counter will be used to identify the *index* where the reference trigger occurred.
-Kevin P
05-17-2019 09:28 AM
Hi Kevin
Thanks for your prompt answer. Meanwhile I get an answer as well form NI. You believe right: Referencetriggers are not supported for counter tasks and counter tasks do not have an FIFO and thus it is not possible to acquire pre trigger samples.
We realized the sync now with in the following way: Register an start trigger to the analog task and an arm start trigger with the same source to the counter task. To realize a similar behaviour as with the reference trigger we do now post process the timestamped data in software.
Regards, Matthias
05-26-2019 09:32 PM
HI Kevin
Now I also encounter the problem of synchronization between analog input and counter input. I have tried many methods, but none of them have solved the problem well. I use the 6368 acquisition card, The following two VI are the programs I triedand I hope to discuss with you.
respect will
05-28-2019 03:51 PM
I have more questions than answers.
1. What kind of device(s) are you using? Constant-rate sampling on a counter frequency measurement task is a somewhat newish feature that isn't supported on all hardware. I haven't personally explored it and don't have a thorough and detailed understanding of what to expect.
2. The timing config found in the 2 vi's you posted are quite a bit different. The first suggests a 2 MHz sample rate, the second suggests 10 kHz or maybe 1 Hz (conflicting info).
What do the signals mean in your system? What's their purpose and meaning? What sample rate(s) do you need and why?
3. What kind of "sync" are you after? Do you want several tasks to sample simultaneously, including having them all take their first sample at the same time? Or do you want them to have different sample rates but the same starting time t0?
4. In your second vi, I doubt the "SyncType" Trigger property is necessary. I've done a *lot* of task sync and I've never used it. I have no real idea how widely it's supported on different kinds of DAQ devices, and as far as I know it could be causing errors in your tasks.
5. I can see that you're trying to share sample clock and trigger signals. That's one aspect of sync -- the part that controls hardware capture. I'm not sure it's entirely correct (b/c I don't know your signals, wiring, or intentions) but you're somewhere in the right neighborhood.
Another aspect of sync is to keep the *data* in sync as you read and process it. I see that you're requesting the same # samples from each task on each loop iteration, which is the right approach.
- Kevin P
05-29-2019 09:25 AM
The code of the sub-VI that is used three times :
After the eventual start trigger, you will get 1 AI (for each channel) and 1 CI sample on each active edge of the external trigger.
Let me know if you need further help.
05-30-2019 02:54 AM
Hi,
Thank you very much for your reply. My synchronization problem has been solved, mainly on the clock setting. I use the PXIe6368 data acquisition card, and what I want to synchronize is that I want the simulation input and the counter input to start at the same time t0, and finish at the same time. The sampling rate for the analog input and counter input tasks is different, so you need to synchronize the Settings to read and process the data.
I would like you to see if there are any problems that need to be improved
05-30-2019 09:37 AM
I can only answer briefly now.
1. The screenshot doesn't look like you've "solved the sync problem."
2. I don't know the purpose of the AO task and you aren't writing any data to it so you're going to get errors.
3. Triggering will be important to start both AI and CI at the same t0. Use a regular Start Trigger for AI, "Arm Start" for CI, both responding to the same signal. Make sure both tasks are started and ready before that trigger edge can happen.
4. To sample CI at a much lower rate than AI may be tricky, especially if you aren't already pretty familiar with counters. Your present intention of doing constant-rate sampling of a CI frequency measurement may also be less than ideal.
For simplicity, I would consider constant-rate sampling of a CI edge counting measurement. I'd "borrow" the AI sample clock for CI. And then, because you seem to want an AI rate of 10 kHz, which is 1000x as fast as the CI rate of 10 Hz, I would read 1000 samples at a time. This gives a *reading rate* of 10 Hz. I would then do a linear fit of the edge count data to give me an average edge frequency during that interval.
5. I still think you should get rid of the "SyncType" DAQmx Trigger property nodes. Never used them, never needed to, not sure what they do exactly, don't know if your board supports them.
-Kevin P
06-09-2019 10:03 PM
Hi,Kevin
Now we have encountered some problems in the synchronization process. Can we communicate with you directly through email? My email address is 526201795@qq.com
Below is my program. I hope you can give me some detailed Suggestions for modification.
Thank you!
06-10-2019 02:40 PM
I put in limited time to offer free help and keep it in the public forums here so more than one person can potentially benefit.
While I'm sure you're spending time on this problem *away* from the forums, so far my questions and comments show a much bigger investment of time *within* the forums than your briefer postings. I don't do that for long. When problems are complicated to describe or implement, I expect the person *needing* help to be the one spending more time on postings, being careful to be clear, thorough, and detailed.
I don't have enough background info yet to give solid advice. For example, you said, "what I want to synchronize is that I want the simulation input and the counter input to start at the same time t0, and finish at the same time". You haven't clearly identified which task corresponds to what you call "simulation input" (though I suspect it's the AI task). You also have 2 distinct counter input tasks. One is pretty easy to sync with AI, the other would require a considerably deeper understanding of counters to explain and implement.
The prior reply from JB in msg #6 addresses sync for the easier CI task, but you'd *also* need to be careful to start CI before AI. It also doesn't address how you'd further sync AO (probably straightforward) and CI Freq measurement (potentially much more advanced).
- Kevin P