Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

C# Minimum Pulse Filter for 6601

Hi All,
 
I may have a problem with too many counts coming back from my 6601 counter. I do have a filter setup although I would like someone to look at my code to reconfirm I have it setup correctly.
 
Here is the code:

countTask =

new Task();

countTask.CIChannels.CreateCountEdgesChannel(grossCountConfig ,

"COUNTIN", CICountEdgesActiveEdge.Rising, 0, CICountEdgesCountDirection.Up);

countTask.Control(

TaskAction.Verify);

countTask.CIChannels.All.CountEdgesDigitalFilterEnable =

true;

countTask.CIChannels.All.CountEdgesDigitalFilterMinimumPulseWidth = 5.0e-6;

myCounterReader =

new CounterReader(countTask.Stream);

countTask.Start();

 

Just a couple more questions,

Now, when I see "countTask.CIChannels.All", I presume this will filter all the counter channels assigned to this task, right?

Also, I know there is a way to test this filter out, but how would I go about doing that? Would I use some sort of pulse train?

If someone could either send me some C# code or point me to a good example of how to test the filter that would be very helpful.

Thanks for all your help in advance!

Matt

0 Kudos
Message 1 of 4
(4,475 Views)

Hi Matt,

You are right in the assumption that "countTask.CIChannels.All" will operate on all the channels in that specific task. One way to test the filter is by using a pulse train where the pulse width will be smaller than the filter. I see that you are setting up a 5us pulse width filter. I verified in the 6601 user manual that a 5 us filter should block a pulse width of 2.5 us or smaller. So you could test that the filter is working by using a pulse train of 2.5 us width or smaller, in which case your task should not count any edges. I suggested that pulse width because pulse widths between 2.5 us and 5 us may or may not pass depending on the relationship of the pulse's phase and the filter's timebase clock. Unfortunately I couldn't find an example that does exactly what you are trying to accomplish, but there are several C# examples that can give you some ideas on your counter application. These examples must be found in your computer on \National Instruments\NI-DAQ\Examples\DotNET2.0\Counter\.

Regards,

Ana P
National Instruments
Applications Engineer
0 Kudos
Message 2 of 4
(4,453 Views)

Hi Ana,

Thanks for the reply. I don't have the  \National Instruments\NI-DAQ\Examples\DotNET2.0\. folder on my pc. 

Does this come with the new NI-DAQmx 8.6.1 software? If not where can I download this sample code?

I am currently using NI-DAQmx version 8.0.11.12.

Thanks,

Matt

0 Kudos
Message 3 of 4
(4,439 Views)
 

Hi Matt,

 

 

The examples are installed when you install the DAQ drivers. Since I don’t know what drivers you have this knowledge base should be helpful in finding them: Programming NI-DAQ in Microsoft Visual Studio .NET. I hope this helps,

Ana P
National Instruments
Applications Engineer
0 Kudos
Message 4 of 4
(4,416 Views)