Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Debouncing Filter with NI-6229 and NI-DAQmx (ANSI C)

Hello,

I'm using a NI-6229 DAQ card and acquiring continous analog input triggered by a TTL trigger sent to PFI0.

In the manual for this, it states:

"You can enable a programmable debouncing filter on each PFI, RTSI, or PXI_STAR signal. When the filters are enabled, your device samples the input on each rising edge of a filter clock. M Series devices use an onboard oscillator to generate the filter clock with a 40 MHz frequency."

I haven't been able to figure out how to access this via the ANSI C version of NI-DAQ (version 7.3) - any suggestions?

Thanks,

Greg
0 Kudos
Message 1 of 7
(4,624 Views)
Replying to myself with a little more detail:

I'm using DAQmxCfgDigEdgeStartTrig and DAQmxCfgSampClkTiming to setup acquisition triggered by a 10Hz TTL pulse wired to PFI0. We're getting extra results that are due to noise.

I've tried using DAQmxSetDigEdgeStartTrigDigFltrEnable and DAQmxSetSampClkDigFltrEnable to turn on the minimum pulse width filter, but I get a return value of -200452 and a message of "Specified property is not supported by the device or applicable to the task".

From what I've read, it is applicable and the device supports this. Could this have anything to do with the M-series being released after 7.3? (I thought I read this somewhere on the ni.com website).

Greg
0 Kudos
Message 2 of 7
(4,605 Views)
Talking to myself again -

Turns out the development machine has NIDAQmx version 7.2 and the acquisition machine is running 7.3. Not sure if this would cause the problem, but will be updating the development machine to 7.3 and retesting soon.

Greg
0 Kudos
Message 3 of 7
(4,600 Views)
Hi,

Yes, you will need NI-DAQ 7.3 to use your M-series device. DAQ 7.2 was released before the M-series and DAQ 7.3 is the newer version that supportes them.

-Sal
0 Kudos
Message 4 of 7
(4,597 Views)
I've reinstalled 7.3.1 on both computers and still get the same message - here's (more or less) the code that starts acquisition:

int32 result = DAQmxCreateTask( "",
&analogInputAcquisitionTaskHandle );

for each analog input channel:

result = DAQmxCreateAIVoltageChan( analogInputAcquisitionTaskHandle,
channelName,
"", // Make the virtual name the same as channelName
DAQmx_Val_RSE, // Referenced single-ended.
analogInputMinValue[ channel ],
analogInputMaxValue[ channel ],
DAQmx_Val_Volts, // Constant from NIDAQ.
"" );

To set up acquisition start:
TRIGGER_SOURCE = /Dev1/PFI0

result = DAQmxCfgDigEdgeStartTrig( analogInputAcquisitionTaskHandle,
TRIGGER_SOURCE,
DAQmx_Val_Rising );

This next line returns an error (-200452 - Specified property not supported by the device or is not applicable to the task)
result = DAQmxResetDigEdgeStartTrigDigFltrEnable( analogInputAcquisitionTaskHandle );

For continuous acquisition:
acquisitionRate = 20.0
result = DAQmxCfgSampClkTiming( analogInputAcquisitionTaskHandle,
TRIGGER_SOURCE,
acquisitionRate,
DAQmx_Val_Rising, // Acquire on rising edge of trigger.
DAQmx_Val_ContSamps,
numSamplesToAcquire );

This next call also succeeds:
result = DAQmxResetSampClkDigFltrMinPulseWidth( analogInputAcquisitionTaskHandle );

But this one fails with -200452 - Specified property not supported by the device or is not applicable to the task:
result = DAQmxSetSampClkDigFltrEnable( analogInputAcquisitionTaskHandle,
true );

Any clues?

Thanks,

Greg
0 Kudos
Message 5 of 7
(4,587 Views)
Hello Greg-

Currently the digital filters on M Series devices can only be configured with counter tasks. That being said, you can create a simple "Count Edges" task, select PFI0 as the input terminal and filter the input terminal. Then in your AI task, just specify PFI0 as your trigger source. Your AI task will receive the filtered signal.

// For reference
DAQmxCreateCICountEdgesChan();
DAQmxSetCICountEdgesTerm(task, channel, "PFI0");
DAQmxSetCICountEdgesDigFltrEnable(task, channel, TRUE);
DAQmxSetCICountEdgesDigFltrMinPulseWidth(task, channel, /* 125 ns, 6.425 us, 2.55 ms */);

I hope this helps!
gus....
0 Kudos
Message 6 of 7
(4,569 Views)
Hi,
for everyone who read this thread entry.

The solution from Gus works, but some extension.
Ther is a bug in the M-Series Manual.

On my NI6221:
DAQmxSetCICountEdgesDigFltrMinPulseWidth(
task, channel, 0.00255)
produces an error when the task started (or when calling DAQmxGetCICountEdgesDigFltrEnable).

0.00256 (2.56 ms) is the correct Value.

And i think it concerns for every M-Series Board.

Additional: you can only set this three  Values :
125 ns, 6.425 us, 2.56 ms
 

- Hope this helps someone

MArtin


0 Kudos
Message 7 of 7
(4,197 Views)