09-24-2018 01:12 PM
I am wondering if the USB-6431 can be used to accurately be used to measure phase using one of the on board counters. It doesn't have simultaneous sampling, but I found that two-edge separation measurements only use one counter, so just wasn't sure if you need simultaneous sampling in order to get a correct phase reading or not. Thanks.
09-24-2018 04:16 PM
What are you measuring the phase OF?
"Simultaneous sampling" is usually referred to for Analog Input. It requires a dedicated A/D converter per channel and is thus more expensive than boards like yours which are multiplexed to share a single A/D converter among lots of channels.
"Two edge separation" is a measurement for counters and needs 5V digital logic signals as inputs.
Since you mention both, I'm unsure what you're actually trying to measure.
Note that if it's a pair of analog signals, a side effect of multiplexing is to add a little bit of phase from one channel to the next. However, it's not too bad to compensate for this numerically in your calculations. The amount of phase will be very precise and repeatable in terms of time, just note that what that means in degrees will depend on the waveform frequency.
-Kevin P
09-24-2018 04:39 PM
It will be used for measuring the phase between channels A and B of an encoder. It will be using a high resolution (1024 ppr) encoder. At the moment I haven't ordered a daq yet, as I saw two edge separation being mentioned for finding phase, and if I can save some money without having to have simultaneous sampling than that is then no reason not to.
09-25-2018 08:12 AM
Ok, so you'll be doing counter-based measurements and you won't need to concern yourself with the lack of simultaneous sampling over in the analog section of the board.
Couple recommendations:
1. If you have the option of using a desktop PC instead of a laptop for your work, I'd recommend you consider a desktop PCIe board instead of USB. The USB bus is a bit of a performance-limiter. I doubt it'd be a problem for this application, but future apps might benefit from the lower latency or higher bandwidth of a PCIe board.
2. You can do better than just 2-edge separation measurement. With one counter dedicated to each quadrature channel, you can capture all the high/low times from each. Then in post-processing you can figure out any edge-to-edge measurement that might interest you.
Note: you'll need to have both counter tasks configured for an "Arm Start" trigger that you can assert after both tasks have been started. If this doesn't make sense yet, don't worry, come on back when you get to that point.
-Kevin P
09-25-2018 08:20 AM
The reason for using USB is that I have a couple different computers it will move between, and would prefer not having to buy a couple PCI cards. Ok perfect that is what I was looking for. I wasn't sure exactly how the counters worked, as the last daq I used only had analog inputs, and wasn't sure if counters needed simultaneous sampling as well to work together or not.
Thanks Kevin.
10-08-2018 01:01 PM
Hi Keven,
I got the DAQ the other day, and have been playing with it some, haven't used a NI daq before and wanted to get familiar with it a little before asking about it. At the moment, I have created the attached VI to find the phase between the two signals. I am not using an arm start though, but since they are running together the two values should be correspondent to the same period correct? I tried to capture each signal on its own, but was getting error messages that had to do with timing and sample rates, which is why I tried it they way I did.
Thanks.
10-08-2018 03:27 PM
I'm still on LV 2016 and can't open your vi. If you backsave to 2016 or earlier (File-->Save for Previous Version...), I can have a look.
-Kevin P
10-09-2018 07:17 AM
Here is a 16 version of it.
10-09-2018 08:51 AM - edited 10-09-2018 08:56 AM
Ok, it looks like you're already pretty close. You *will* need an Arm Start trigger to sync the measurements properly.
I started typing some explanation, figured it'd be easier to modify the code to illustrate. Attached is modified code that worked for me on a similar desktop X-series MIO board. I added the ability to define the polarity for both the period and 2-edge separation measurements. I also added Arm Start triggering to the 2 tasks, as well as a DO task that can generate the trigger pulse after the counter tasks are started and ready for it.
Now that you can see how to do the Arm Start triggering to sync the measurements, you may want to consider setting up both counter tasks for semi-period measurement (or perhaps the newer Pulse measurement that seems to be supported on X-series boards). That let's you find the all edge times for both A and B channels, from which you can derive many additional kinds of characterizations.
-Kevin P
10-09-2018 09:20 AM
Thanks for that example, and your help Kevin. I ran your example, a few times and noticed that the first element is always very high. I am guessing that is just from the time it takes for the Arm Start to generate the trigger pulse, and it can just be removed. The other problem is one in every 10 runs or so I get the following message about the acquisition being stopped before the number of samples. It only seems to happen when the number of samples is around 1000 though.