Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Urgent DigitalFilterEnable for PCI-6221

I am trying to enable digital filtering on a PCI-6221 DAQ card. According to your specs, digital filtering is supported on the DIO lines. I am using C# with Measurement Studio 8.0.1.334, and NIDAQmx 8.1.20.25. My code is as follows:
 
/// <summary>
/// Initializes a new instance of the LaserFootswitchMonitor class.
/// </summary>
/// <param name="digitalInLineToMonitor">The digital input line on which the footswitch is monitored.</param>
/// <param name="monitorInterval">The interval, in milliseconds, to monitor the footswitch.</param>
public LaserFootswitchMonitor(string digitalInLineToMonitor)
{
    Debug.Assert(!String.IsNullOrEmpty(digitalInLineToMonitor));
    taskDigitalIn = new NationalInstruments.DAQmx.Task();
    taskDigitalIn.DIChannels.CreateChannel(digitalInLineToMonitor, "LaserFootSwitch", ChannelLineGrouping.OneChannelForEachLine);
    taskDigitalIn.DIChannels[0].DigitalFilterEnable = true;
    taskDigitalIn.DIChannels[0].DigitalFilterMinimumPulseWidth = 0.1;
    taskDigitalIn.Timing.ConfigureChangeDetection(digitalInLineToMonitor, digitalInLineToMonitor, SampleQuantityMode.ContinuousSamples, 1);
    taskDigitalIn.SynchronizeCallbacks = true;
    taskDigitalIn.DigitalChangeDetection += new DigitalChangeDetectionEventHandler(taskDigitalIn_DigitalChangeDetection);
    digitalDataReader = new DigitalSingleChannelReader(taskDigitalIn.Stream);
    taskDigitalIn.Control(TaskAction.Verify);
    taskDigitalIn.Start();
}
digitalInLineToMonitor = "Dev1/port0/line0"
 
When I set DigitalFilterEnable = true, I get the error "Specified property is not supported by the device....."    Status Code: -200452
 
Your specs say digital filtering is supported, so how can I get this to work?
0 Kudos
Message 1 of 12
(4,887 Views)
If have unfortunately no experience with your programing environement !

However, the problem seems to be related to the hardware. Unless I'm wrong, you have set a filter value of 0.1s. But, according to the specifications of the PCI-6221 only 3 values are allowed :
  • 125 ns
  • 6.425 μs
  • 2.56 ms
Please run your code with one of them and let us know if it works.
0 Kudos
Message 2 of 12
(4,878 Views)
Thanks for your response. The problem is that the error occurs before I set the filter minimum pulse width. I did look at the specifications for the PCI-6221 in the link you gave me and I did see a problem. The debounce filter settings are listed under the PFI/Port1/Port2 functionality. Is it that Port0 does not support debounce filters? If so, I am screwed, because Port0 is the only port that supports change detection, correct?
0 Kudos
Message 3 of 12
(4,875 Views)
Unfortunately, you are correct.  Port0 does not support filtering.  From the documentation:

PFI/Port 1/Port 2 Functionality
Debounce filter settings .................. 125 ns, 6.425 μs, 2.56 ms, disable;

Device-To-Device Trigger Bus
Debounce filter settings...................125 ns, 6.425 μs, 2.56 ms, disabled;

So, all the PFI lines and RTSI (PXI_Trig) lines support filtering.  Port0 lines do not.

------
Zach Hindes
NI R&D
0 Kudos
Message 4 of 12
(4,849 Views)

So the bottom line is that I can't do change detection accurately, because I can't do change detection and digital filtering on the same DIO lines?

Can someone from NI weigh in on this? How can I do change detection without detecting glitches?

0 Kudos
Message 5 of 12
(4,845 Views)
Why not using an external filter ?
0 Kudos
Message 6 of 12
(4,833 Views)

Hi DRT,

Here are couple of options you might consider to avoid detecting glitches:

  • Use external debouncing circuitry as suggested by JB
  • Alternatively, the PFI lines, which do support digital filtering can be routed to digital change detection lines.  This might be worth a shot.
Jared T.
0 Kudos
Message 7 of 12
(4,826 Views)

Well, I tried your suggestion about filtering on Port1 or Port2 instead of Port0, but I got an error message indicating that digital filtering is not supported on those ports. I think that NI needs to thoroughly document which features are supported on which boards, down to the little gotchas like which DIO ports support filtering, which supprt change detection, etc.

I ended up falling back on the old standby that I know works, and that's timer-based polling, not a very elegant solution.

0 Kudos
Message 8 of 12
(4,763 Views)

Hi DRT,

Just to confirm, you have tried to enable digital filtering on Port 1 or Port 2 and you got the same error message as before? Do you have a 37 pin version of the PCI-6221?  I noticed that there is a footnote in the manual (page 6, where it discusses the debounce settings for Port 1 and Port 2) that says that “Port 2 is not available on PCI-6221 (37-pin) devices.”

Please let us know if you can’t enable the digital filtering on Port 1 or Port 2.  If this is the case, then we will need to get R&D involved to verify this behavior and correct the documentation.   You make a valid point that the documentation should be improved.

 

Here are a couple of other links I can across:

How Can I Remove Glitches or Bounce on My Digital Line?

Enabling the Digital Filters for Counter/Timer Devices in NI-DAQmx

How Do I Remove Glitches or Add a Debounce Filter to My Digital Signal?


Jared T.
0 Kudos
Message 9 of 12
(4,732 Views)

Hi DRT,

I must apologize, because I came across some information that may help us make sense of what is occurring.

Digital filtering is only available on the PFI lines for counter tasks on M-Series.  Check out the PFI Filters section in the M-Series user manual.

I page 8-4 there is the following note: "NI-DAQmx only supports filters on counter inputs."

This means that for a digital input/output task NI-DAQmx does not support digital filtering.  I completely agree with you that this important information should be clearly stated in the specifications for the PCI-6221 and other M-Series devices.  Rest assured I will take the appropriate action to request that it be fixed.  Sorry again for any inconvenience this may have caused you.


I did come across one possible workaround where a "dummy" counter task is creating using the PFI line of interest as one of the counter inputs and enabling filtering on it through the counter options of the DAQmx Channel Property Node as explained in this knowledge base:

Digital Filtering with M Series and CompactDAQ

Jared T.
0 Kudos
Message 10 of 12
(4,721 Views)