LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I simultaneously measure two frequencies using the two counters on a CompactDAQ chassis?

I am using two encoders as speed wheels to compare two different speeds simultaneously.  I have the encoders connected to the two counter inputs of my CompactDAQ chassis using NI 9423 cards in order to measure the frequencies produced be each and then I convert that data into speed.  How do I efficiently measure these frequencies simultaneously?  I say efficiently because the only way I can get it to work right now is to create a task for the first encoder, gather my frequency data, clear the task for that encoder and then move onto the next.  This is a slow process and therefore the measurements are not exactly simultaneous.  If I try to measure them simultaneously I get resource errors.
0 Kudos
Message 1 of 8
(3,993 Views)
Hello Kelvador,

Could you please give me more information about your application. Are you using two different 9423 modules to measure the two different frequency inputs? You can probably create two separate tasks in parallel to get your frequency inputs to be synchronized.

Would it be possible to post your code so that I can take a look at it. You mentioned that you are receiving resource errors when you try to simultaneously run the tasks. Are you creating multiple tasks for the two counters running in parallel and what exactly are the errors that you are receiving?

Regards,
Raajit L
National Instruments
0 Kudos
Message 2 of 8
(3,966 Views)

Hello Raajit,

Right now I am using a 9401 in slot 5 of my 9172 and a 9423 in slot 6.  I have attached my code.  Right now it is quite simple...I'm trying to get past this hurdle before I proceed with the rest of the program.  I create two counter channels and try to acquire frequencies from my encoders in two parallel loops.  When I run the vi the Loop 1 Iteration counts up very quicky because it can't perform the DAQmx Read.  Loop 2 Iteration counts up every second with my 1 second timeout unless I spin my encoder; loop 2 is able to acquire my frequency data.  I have two stop buttons on the program for debugging purposes.  When I stop the vi completely I get the following error:

Error -50103 occurred at DAQmx Start Task.vi:3

Possible reason(s):

The specified resource is reserved. The operation could not be completed as specified.

Task Name: _unnamedTask<C>

I hope this helps you understand what I'm trying to accomplish.  Any suggestions you can offer will be greatly appreciated.  Thanks Raajit.

Kevin

0 Kudos
Message 3 of 8
(3,955 Views)
Hey Kevin,

Thank you for the information. The cDAQ-9172 has two counters on the chassis itself.  There are no counters on the actual module.  What this means is when you access Counter 0 using a module in slot5 (for example), you are actually accessing Counter 0 on the backplane of the chassis.  This is why you are getting the resource is reserved error.  If you have the other input frequency connected to the second counter of the chassis, you just need to access it using Counter 1 instead of Counter 0.

In your code, for the Counter 2 input, you have "cDAQ1Mod6/ctr0".  If you just change that to "cDAQ1Mod6/ctr1", this will get rid of your "resource is reserved error.  Also, to get both your tasks to be a little more closely synchronized, you should probably use a sequence structure to be sure that they start together. In the code below, I have used two seperate counters on two different modules and synchronized them.  If you are using the same module you would just need to change the counter inputs to represent the two different counters on the same module.


Hope that helps.

Regards,

Message Edited by Raajit L on 04-02-2007 11:00 AM

Raajit L
National Instruments
Message 4 of 8
(3,942 Views)
Ahhh, there we go!  I forgot that the two slots share two counters...I kept thinking that counter 1 was for slot 5 and counter 2 was for slot 6.  Thanks for the help Raajit!
0 Kudos
Message 5 of 8
(3,923 Views)

Hello,

I am trying to Measure the 2 High Frequency Parallel using cDAQ- 9174 with the help of NI9402 (They have Four Digital I/O)

 

I have make the Code as follow,

plz help me

Thanks a lot in Advance!

 

 

Mr. Prashant A. Shirke
R&D Engineer
0 Kudos
Message 6 of 8
(2,805 Views)

This discussion is over 10 years old and you probably should have started a new thread.

 


@MrPrashant wrote:

 

I have make the Code as follow,

plz help me

 


So what problems do you need help with? (You basically copied the above code, but are only reading one sample at the end. Is this really what you want?)

0 Kudos
Message 7 of 8
(2,796 Views)

Hertly Thanks for your reply!

1.

I want to measure Two different frequencies of 6MHz  by cDAQ 9174 with the help of NI 9402

2.

So I will going to measure the one frequency of 6MHz 1st channel of NI 9402 and another frequency of 6MHz on 2nd Chanel of same Module (NI9202)

3. 

I have tried the measure frequency by Daq Assistant 

When I measure the this two frequency simultaneously then only one Frequency shown at a time and another on is zero

4. May be this is problem deu to synchronization,

First tell me it possible to measure two frequencies of 6MHz by with the help of cDAQ9174 by using single module NI 9402

5.

If possible what I can do?

 

Thank you so much altenbach

 

Mr. Prashant A. Shirke
R&D Engineer
0 Kudos
Message 8 of 8
(2,786 Views)