Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Update value of a frequency channel

Hello,
 
I have created a frequency task channel by using DAQMX function (DAQMXCreateCIFreqChan) using one counter. With a timer I read the value every 0.05 sec.
That works fine but I get a new value only every +/- 0.15 sec. Is it possible to get a value refreshed every 0.05 sec even if the accuracy decrease ?
Also, the accuracy of the value is good by multiplied by two. It's not really a problem but if you know the reason?
Thanks for your help.

 

0 Kudos
Message 1 of 3
(3,150 Views)

Hi Gzen,

First one, it seems you are not working with LabVIEW. Which program are you working with? Measurement Studio for VB, C#, C++, .NET ?

Second one, it seems that you are not giving a timing inside your program. Am I correct? And the problem you mentionned above could appear! Let's me explain : If you are not providing time in your programmation. The program will execute your code as fast as possible un-regarding of your User Interface refresh ! Most of the CPU will be taken by the execution of your code and when your CPU has the possibility, it updates/refreshes the User Interface.

Third one, for the value multiply by two, I don't know what happens to your program... Smiley Sad

Regards,

Julien Roland - District Sales Manager
NI Belgium - Technical Support

Don't forget to rate a good answer
0 Kudos
Message 2 of 3
(3,118 Views)

Dear Julien,

Thanks for your reply.

Sorry I forget to give much information. It’s programmed in VB6 and I’m using the DAQmx API. The card is a DAQPAd 6015.

 

The code for the frequency channel is the following:

-DAQmxErrChk DAQmxCreateTask("", taskhandle2)

-DAQmxErrChk DAQmxCreateCIFreqChan(taskhandle2, "DEV1/ctr0", "", 2, 50000, DAQmx_Val_FrequencyUnits3_Hz, DAQmx_Val_Edge1_Rising, DAQmx_Val_CounterFrequencyMethod_LowFreq1Ctr, 0.05, 4, "")

 

In a timer (at 0.05s) I use the following:

-DAQmxErrChk DAQmxReadCounterScalarF64(taskhandle2, 0.01, dataF, ByVal 0&)

 

 

In the same time I have a second task using the analog channel configured like this:

- DAQmxErrChk DAQmxCreateAIVoltageChan(taskHandle, "Dev1/ai0", "", _DAQmx_Val_Cfg_Default, 0, 10, DAQmx_Val_VoltageUnits1_Volts, "")

- DAQmxErrChk DAQmxCfgSampClkTiming(taskHandle, "OnboardClock", 20, DAQmx_Val_Rising, DAQmx_Val_AcquisitionType_ContSamps, 1)

 

And I do the following items in a loop :

- DAQmxReadAnalogF64 taskHandle, numSampsPerChannel, 10#, fillMode, data(0), arraySizeInSamps, sampsPerChanRead, ByVal 0&

- Doevents (to allow the timer to refresh the frequency value)

- I save the value of the analog channel and frequency channel into memory.

 

When test is finished (max 10sec), I save the values from the memory to a file. For the analog channel there are no problems, just for the frequency channel, I get the value change only every three data.

 

Best regards,

 

Greg

Message 3 of 3
(3,106 Views)