11-14-2006 02:01 PM
a. If so, what is the syntax to use?
2. What would all the settings be?
a. What would the Channel and Timing parameters be for CountDigEventsContinuous_BufferedExtClk?
3. Are there any other extra lines of code that need to be added and where?
4. What should the output look like if it is working correctly?
Thanks,
mtonsager
11-15-2006 09:34 PM
11-16-2006 08:20 AM
Thank you very much for the reply.
I was able to get everything to work through the DaqSystem.Local.ConnectTerminals.
My main goal is to simulate a count/digital signal that the 6601 card will be receiving from an optical device that sends the signal 6-10 times a second.
I am curious as to what the dutyCycle does. Whenever I change the duty cycle I don't see any differences in the output. So, what is the duty cycle used for and what are the value ranges for it?
Also, eventually I will have to be able to Filter out Noise from the signals. What do I need to know? What would be the best filter to use and how would I implement this using .NET and Measurement Studio 8.0?
Thank you much,
mtonsager
11-17-2006
03:01 PM
- last edited on
01-02-2024
02:16 PM
by
migration-bot
Hi mtonsager,
The duty cycle is defined as the ratio of the duration (time) that a signal is 'on' to the total period of the signal. So a 50% duty cycle would be when the signal is high and low for equal amounts of time (which is generally the case). Generally you have to set the duty cycle before you begin the generation.
There are certain digital filters available to you. The Help file for your device and go to TIO Series Help -> Counters -> Digital Filters has all the information. There is some additional information in the M Series DAQmx Help (M Series Help -> Counters -> Other Counter Features -> Filters). There is also an example program which shows how to turn on the Filter using a property node.
Cheers
Malay
11-20-2006
01:33 PM
- last edited on
11-07-2024
09:59 AM
by
Content Cleaner
Hi Malay,
Thanks for the reply again.
I searched through the documentation, but I am not sure what I need to open up a .vi file because I only have .NET and MS 8.0.1.
However, I did more testing to figure out how the filters work and I know I must be close, but am having no luck in filtering out by pulse width.
First, I connected the two counter terminals:
DaqSystem.Local.ConnectTerminals("/Dev1/Ctr0InternalOutput", "/Dev1/PFI33");
Second, I set up a Pulse train:
taskPulseTrain =
new Task("test");
taskPulseTrain.COChannels.CreatePulseChannelFrequency(
"Dev1/ctr0", "External", COPulseFrequencyUnits.Hertz, COPulseIdleState.Low, 0, 100, .0002);
taskPulseTrain.Timing.ConfigureImplicit(
SampleQuantityMode.ContinuousSamples, 1000);
taskPulseTrain.Start();
Third, I set up the second Buffered task to read the filtered counts:
t =
new Task();
t.CIChannels.CreateCountEdgesChannel(counterComboBox.Text,
"COUNTIN", edgeType, Convert.ToInt64(initialCountTextBox.Text), countDirection);
t.Timing.ConfigureSampleClock(sampleClockTextBox.Text,
Convert.ToDouble(rateTextBox.Text), SampleClockActiveEdge.Rising,SampleQuantityMode.ContinuousSamples, 1000);
t.Control(
TaskAction.Verify);
t.CIChannels.All.CountEdgesDigitalFilterEnable =
true;
t.CIChannels.All.CountEdgesDigitalFilterMinimumPulseWidth = .008;
myCounterReader =
new CounterReader(t.Stream);
myCallBack =
new AsyncCallback(CounterReadCallback);
myCounterReader.SynchronizingObject =
this;
myCounterReader.BeginReadMultiSampleDouble(
Convert.ToInt32(sampleToReadTextBox.Text),myCallBack,null);
I found this equation here duty cycle = 100*(pulse width/period) where period = 1/Frequency OR pulse width = period*(duty cycle/100)
Given this equation I figure the pulse width of my taskPulseTrain is (1/100Hz)*(.0002/100) = .00000002
So, when I set up the minimum pulse width to be .008 it should filter out all the pulses in the taskPulseTrain because all of the pulse widths are too short, right?
I am not sure why I keep getting the same results when I change either my minimum pulse width on the filter or my duty cycle in the pulse train.
Thanks,
Mtonsager
11-21-2006 11:21 AM
Hi again,
After reading my last post it became clear that I should explain a bit more.
Basically, I am just trying to filter out certain pulses based on the equation I gave above and it does not seem to be working.
My thoughts are that either this is not the equation I should use, or there is something I am still missing in my code to get the filter to work.
Thanks,
Mtonsager
11-21-2006 04:29 PM - edited 11-21-2006 04:29 PM
Message Edited by 50ohmTerminator on 11-21-2006 04:31 PM
11-22-2006 09:09 AM
Hi Malay,
Thanks for your help.
I am still unable to get the filter to work and I don't have the equipment to connect the terminals externally. I am using a 6601 card in my pc. Yes, I am using PFI 33 for my clock source on my second task. I tried these four values in the filter (0.000000, 2.560000e-3, 6.425000e-6, 125.0e-9), but when I tried 0.000000 it gave me an exception that said:
Request is not a supported value for this property
valid values begin with: 100.000000e-9
valid values end with: Inf
Then I tried 125.0e-9 and I received this error:
Desired minimum pulse width could not be produced
Minimum pulse width is affected by the digital filter timebase source and the digital Filter timebase rate...
Supported values: 100.000000e-9, 400.000000e-9 to 171.797692e3
I am unsure of what values you are using for your pulse train to test these filter settings. Would you still have the code that you used to test these settings?
Also, since I am using a buffered counter with the asynchronous methodology, when the signal is filtered out it will not fire off the asynchronous method, right?
Thanks Malay,
Mtonsager
11-27-2006
02:20 PM
- last edited on
01-02-2024
02:17 PM
by
migration-bot
Hi Mntonsager,
How will you be connecting your external signal? For now you are simulating the input by creating a signal on the counter output. Will you be getting a terminal block to make your final connections? The same terminal block could be used to connect the two PFI lines. For now the internal connection should work.
Enabling the Digital Filters for Counter/Timer Devices in NI-DAQmx outlines the calls to make for setting the filters. According to the TIO help linked in the above post, the valid settings for the filter are 100ns, 500ns, 1us and 5us if the default timebase is used. Does a value of 100e-9 work? Other values can be used if an external clock is supplied for the filter timebase.
Once the signal is filtered, pulses which did not meet the minimum pulse width will no longer be present and should not cause your count to increment. The filter is implemented in hardware and it will not matter that you are doing buffered measurement. Note that there will be a finite delay between your original and filtered signal. For the TIO board this will be 2 filter clock time periods. For more information, search the NI-DAQmx C Reference Help for "digital filter clock". This will bring up useful information under the heading "Digital Filtering Considerations for TIO-Based Devices".
Regards,
Jennifer O.
11-28-2006 07:37 AM
Thanks for the information Jennifer.
Basically, the only thing I want to do right now is to test the filter settings to see if they work.
In the documentation for the 6601/6602 counter device manual it says you can use defined filter settings to remove noise/glitches narrower than 2.5us, 500ns, 250ns, and 50ns.
Is this how I would implement the filter for 2.5us in .NET and MS 8.0.1?
t.Control(TaskAction.Verify);
t.CIChannels.All.CountEdgesDigitalFilterEnable = true;
t.CIChannels.All.CountEdgesDigitalFilterMinimumPulseWidth = 5.0e-6;// This guaranteed to pass 5micorsecond pulse, guaranteed to block 2.5microsecond spikes/pulses
If I do the "TaskAction.Verify" above I think it just uses the 20MHz timebase, right? Is this the timebase I should use?
So, now for my other counter (pulse train) this is connected to, what would my frequency and my dutycycle be to see if it does, in fact, filter out these pulses?
Or, perhaps, there is another way to test these filter settings. Would you know how to test them?
Thank you much Jennifer!
Mtonsager