Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

how to configure in vb .net a counter input filtering

Hi!

 

I have a project with pci 6220!

 

I configure this card with visual basic .net functions. I made a linear encoder channel with the daqmx functions in vb.

It works! The sample code:

 

myCounterTask.CIChannels.CreateLinearEncoderChannel("Dev1/ctr0", "utmero", _

                 CIEncoderDecodingType.X4, False, 0, CIEncoderZIndexPhase.AHighBHigh, _

                  1 / increments, 0, CILinearEncoderUnits.Meters)

 

        

myCounterTask.Timing.ConfigureSampleClock("Dev1/PFI13", m_frek, _

                SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, 1000)

 

 

I use an internal sample clock! I got this code from the sample codes from the ni dvd.

 

 

 

Now I need to filter this counter input because it is noisy 🙂

I need some help to write this code. I dont know how to use these properties:

- FrequencyDigitalFilterEnable

- FrequencyDigitalFilterMinimumPulseWidth 

- DigitalFilterTimebaseRate

- DigitalFilterTimebaseSource 

 

 

 

Please write me the sample code how to configure and use these properties !

 

 

Thank You!!!! 

0 Kudos
Message 1 of 3
(6,422 Views)

Hi Jon,

 

The Timebase Rate and Timebase Source properties aren't used with M Series devices, so all you have to set is Digital Filter Enable and Digital Filter Minimum Pulse Width.  Your board gives 3 discrete Minimum Pulse Width options (125 ns, 6.425 μs, 2.56 ms).  This is the minimum pulse width that is guaranteed to pass through the filter, so you should choose one of these values in accordance with the minimum pulse width of your input signal.

 

More explanation on the filters can be found in the M Series User Manual (starting at the bottom of page 8-4).

 

 

If you're looking for the properties to set in the .NET API for your encoder task, they should be as follows for the A B and Z inputs:

EncoderAInputDigitalFilterEnable

 

EncoderBInputDigitalFilterEnable

 

EncoderZInputDigitalFilterEnable

 

The property to set is tied to the specific task type, so you need to make sure to use the Encoder ones rather than the Digital Frequency task type like the properties you linked.

 

 

Best Regards,

John Passiak
0 Kudos
Message 2 of 3
(6,416 Views)

Thank You for Your quick answer!

 

So I need to use this properties like these:

 

 

Channel A: 

-  myCounterTask.CIChannels.CreateLinearEncoderChannel("Dev1/ctr0", "utmero", _

                 CIEncoderDecodingType.X4, False, 0, CIEncoderZIndexPhase.AHighBHigh, _

                  1 / increments, 0, CILinearEncoderUnits.Meters).EncoderAInputDigitalFilterEnable = True

 

- myCounterTask.CIChannels.CreateLinearEncoderChannel("Dev1/ctr0", "utmero", _

 CIEncoderDecodingType.X4, False, 0, CIEncoderZIndexPhase.AHighBHigh, _

                  1 / increments, 0, CILinearEncoderUnits.Meters).EncoderAInputDigitalFilterMinimumPulseWidth = 257       (???6.425 us???)

 

 

 

Channel B:

-  myCounterTask.CIChannels.CreateLinearEncoderChannel("Dev1/ctr0", "utmero", _

                 CIEncoderDecodingType.X4, False, 0, CIEncoderZIndexPhase.AHighBHigh, _

                  1 / increments, 0, CILinearEncoderUnits.Meters).EncoderBInputDigitalFilterEnable = True

 

- myCounterTask.CIChannels.CreateLinearEncoderChannel("Dev1/ctr0", "utmero", _

 CIEncoderDecodingType.X4, False, 0, CIEncoderZIndexPhase.AHighBHigh, _

                  1 / increments, 0, CILinearEncoderUnits.Meters).EncoderBInputDigitalFilterMinimumPulseWidth = 257       (???6.425 us???)

 

 

Am I right?

 

 

Thanks!

 

 

JonMeklen 

 

 

            

0 Kudos
Message 3 of 3
(6,396 Views)