06-08-2015 02:33 AM
Hello everyone,
I have a timed while loop that is currently governed by the default KHz sample clock (on Windows). I need better resolution than this sample clock can give me, and am looking into external timing sources. I am currently using a PCIe-6320 for data acquisition, and am reading that it has a 1MHz onboard clock. I'm hoping that I can use this to get the timing accuracy I need out of the while loop, but I'm having trouble setting up the external source through DAQmx. What would be the most straight-forward way to implement a simple, fixed-interval timing source for the while loop using the 6320, or is it even possible? Thanks for your help!
06-08-2015 08:04 AM
user0110 wrote:
I have a timed while loop that is currently governed by the default KHz sample clock (on Windows). I need better resolution than this sample clock can give me
On Windows? Not a chance. If you need something to be more deterministic than a few ms, then you need to go to a Real Time system.
06-08-2015 08:37 AM
What you usually do it set up a sample speed with the DAQ and grab a bunch at a time. You can e.g. set 10kHz sample speed and grab 1k samples at a time for a UI update of 10 Hz.
What are you trying to achieve?
/Y
06-08-2015 09:04 AM
I'm polling a rotary encoder every loop iteration to calculate the speed of a spinning cylinder. In this case, a millisecond in either direction is a huge difference in number of encoder ticks used to determine the speed.
06-08-2015 10:15 AM
@user0110 wrote:
I'm polling a rotary encoder every loop iteration to calculate the speed of a spinning cylinder. In this case, a millisecond in either direction is a huge difference in number of encoder ticks used to determine the speed.
You could just use a Counter for that. Alternatively, use an FPGA.
06-08-2015 11:30 AM
@user0110 wrote:
I'm polling a rotary encoder every loop iteration to calculate the speed of a spinning cylinder. In this case, a millisecond in either direction is a huge difference in number of encoder ticks used to determine the speed.
That's why you dont use software timing.
As mentioned above a Counter is the best solution, but in case you dont have any, setup a sample rate in hardware and extract and calculate an array at a time.
/Y
06-08-2015 03:20 PM - edited 06-08-2015 03:23 PM
How does a counter get me timing information? I'm using one already to read in the ticks of the rotary encoder, but how does that give me loop timing?
EDIT: can you also elaborate on setting up the sample rate to be read in arrays? Thanks for the help!
06-08-2015 04:27 PM
@user0110 wrote:
How does a counter get me timing information? I'm using one already to read in the ticks of the rotary encoder, but how does that give me loop timing?
Depending on the card/counter you are using, you can set it up to give you frequency.
06-09-2015 02:53 AM
Are you saying that I can generate frequency with a counter that could be used as the loop timing source? Could you direct me to an example of what you're describing?
06-09-2015
03:07 AM
- last edited on
10-21-2025
10:02 AM
by
Content Cleaner
No, you'd use a Counter input to measure the frequency of the encoder output pulse. If you know the spatial resolution of the encoder (via counts per rev, or distance/angle per count etc) you can convert from frequency to speed.
Alternatively, you can use a Counter input and the outputs of the encoder to measure position, then numerically differentiate the position array/waveform to get speed. The downside is that numerically differentiating a noisy (read: jittery) signal tends to amplify noise.
Some simple links:
Use Counter Frequency to obtain an Encoder Rotational Speed
Encoder Measurements - How To Guide