06-19-2015 09:53 AM
Hello,
I am trying to measure frequency using NI 9402 in NI cDAQ9178 chassis. I am setting the clock for my counter channel to be my chassis ai Sample Clock.
I am able to measure frequency above 20 Hz. For frequencies less than 20Hz, I get the following error:
DAQmx Error: Multiple Sample Clock pulses were detected within one period of the input signal. Use a Sample Clock rate that is slower than the input signal. Ifyou are using an external Sample Clock, ensure that clock signal is within the jitter and voltage level specifications and without glitches.Task Name: _unnamedTask<0>
Status Code: -201314
Setting the Rate to 1 also not does resolve the issue.
OTHER DETAILS:
* Running on 64 bit, Win7 platform.
* NIDAQmx Driver Version: 14.5
I had posted regarding this earlier and I was told that this might be because the counter is armed immediately before the first sample is taken. The recommendation was to add a hardware-timed delay using the DAQmxSetStartTrigDelay method to the AI task. I have added this delay but I still receive the same error message. The previous post I had mentioned can be found below:
I have also attached my current code which has the delay. Is this a bug in the driver? If yes, can we have a CAR# to track this?
Thanks.
Regards,
Varun Hariharan
The MathWorks
06-30-2015 11:26 AM
Hi Varun,
I'm grabbing the hardware to test this now.
In the meantime I have a few questions for you.
What is the source of your 20 Hz signal? Can you scope the signal with high impedance to make sure that it is actually at 20 Hz and at the correct logic levels?
If you're using an external 20 Hz signal, can you generate the signal from the chassis itself and test it that way?
-CB
06-30-2015 01:40 PM - edited 06-30-2015 01:41 PM
Alright so I got everything working correctly in both C and LabVIEW code.
The problems is in fact with the first sample, as John_P1 suggested. You simply need to delay that first sample from being requested. It is simple to do this in software instead of hardware.
If you are using CVI, just add #include <utility.h> to the top of your .c file and then add a delay before your DAQmxErrChk (DAQmxStartTask(AItaskHandle)); line.
Comment out / remove the DAQmxSetStartTrigDelay(AItaskHandle,10); line, as it wasn't doing what we thought it would. (Hardware delay).
I added Delay (.05); to delay long enough for the full period of the input signal at 20 Hz.
Depending on your frequency, this value may need to be adjusted. 100ms wouldn't be a bad idea.
This is expected behavior, and I don't think we need a CAR.
Let me know what you think!
-CB
07-01-2015 09:18 AM
Hello Casey,
Thanks for sending me that. I was able to get the C program to work with the change that you had recommended. However, I would like to know how the DAQmxSetStartTrigDelay is expected to work. Is the non-zero status expected when we call the method like we had in my original post?
Thanks,
Varun Hariharan
The MathWorks