LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

External source for timed while loop

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!

0 Kudos
Message 1 of 10
(3,697 Views)

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.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 10
(3,664 Views)

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 10
(3,655 Views)

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. 

0 Kudos
Message 4 of 10
(3,647 Views)

@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.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 10
(3,638 Views)

@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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 10
(3,625 Views)

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!

0 Kudos
Message 7 of 10
(3,615 Views)

@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.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 10
(3,600 Views)

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?

0 Kudos
Message 9 of 10
(3,580 Views)

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

---
CLA
0 Kudos
Message 10 of 10
(3,570 Views)