LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Starting and Stopping Counters

Hello
 

I have a 2 channel quadrature encoder with Z-indexing and a NI-USB-6211 board. I was wondering if I would be able to start my VI and measure the frequency of the counter edges using a 2 counter method. Once a particular speed is reached I want to stop recording the frequency of the encoder and start measuring the angular position (also a 2 counter method) and an analog signal. Is this possible or will I get an error telling me that the counter is reserved? If this can be done do you have some suggestions how I would do this? I am not very proficient with Labview.

 

Thank you very much

Noel

0 Kudos
Message 1 of 3
(2,433 Views)

Hello Noel,

 

If I understand correctly you want to be able to change the type of counter measurement you're making on the fly from frequency to position.  If this is the case it's not possible while the task is running, but I do have a couple of suggestions.

 

1.  You could do this change in software by stopping the counter input (CI) frequency task and then configuring and starting the CI angular position task.  This would inherently have a delay between stopping one measurement and stopping the other, but it would allow you to make the change you want.  To implement this you'd basically combine two example programs and run one after the other.  Take the CI Frequency example and add a case statement so that it exits the while loop when a certain value is reached.  Then, at the end, paste in the CI position example to start that measurement.

 

2.  This would be my personal preference of how to achieve this goal.  Essentially frequency (velocity) and position are equivalent values when they are associated with a known time.  What I mean is that you could technically only measure position (or frequency) the entire time and just calculate the velocity (or position) from this measurement since you know the time between samples (Velocity = distance/time = (PositionX- PositionX-1)/(TimeX-TimeX-1)).  Using this approach you'd be able to have a graph of both position and velocity available for the entire test.  To implement this method just use one of the examples and add some analysis to the loop to calculate and graph the velocity or position.  You also have the option of calculating the velocity or position in a post-acquisition step if you run into issues with the processing time.

 

I hope this helps get you started.  Have a great night!

Brooks
0 Kudos
Message 2 of 3
(2,413 Views)
Thank you very much for your response
 
Noel
0 Kudos
Message 3 of 3
(2,411 Views)