Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with PFI0 on DAQCard-6062E

Dear community,
 
I am trying to measure the rotational speed of a test assembly by the PFI0 input.
 
My test assembly provides a rotational synchronous pulse (one pulse per revolution) which I feed (via an opto-coupler) to the PFI0 input of a DAQ board. I have checked this signal and it is a very clean rectangular signal (period 275 ms, pulse width 15 ms, low voltage 40 mV, high voltage 4.4 V, rising time 6 µs, falling time 8 µs, bouncing-free).
 
I have set up the program to measure the frequency of the PFI0 input between the rising edges of the signal. The program code is shown below. I am using Microsoft Visual Basic .NET 2003 and NIMS V7.1.
 
With a NI PCI-6220 DAQ board I have no problems. It is giving the rpm values as I expect them.
 
However, with a DAQCard-6062E I have problems to get the right rpm values. Many times the reading is correct and gives a reading of 3.63/s (corresponding to the period of of the input signal of 275 ms). But quite often I get readings of 3.84/s (corresponding to the low-period of the signal which is 275 ms - 15 ms = 260 ms) and 66.6/s (corresponding to the high-period of 15 ms).
 
It seems as if the DAQCard does not care about the rising edge condition, but often measures between any two edges (rising or falling).
 
Sometimes I even get the error message -200140: "Two consecutive active edges of the input signal occurred without a counter timebase edge. Use a faster counter timebase."
 
The behaviour could be explained if I would use a bouncing input signal to the DAQCard. But as explained above the input signal is very clean, not too fast, and the same configuration works perfectly on a PCI-6220.
 
Is there anything I might have overlooked?
 
I have tried to apply an input filter on the PFI0 input. But obviously this feature is not supported on the DAQCard-6062E.
 
Any help is much appreciated.
 
The attached ZIP file includes the source code as well as oscilloscope hardcopies of the rot.sync. signal.
 
Best regards,
Detlef

I am using Microsoft Visual Basic .NET 2003 and NIMS V7.1.

Initialization sequence for the rpm measurement:
    Dim mCounterTask As Task
    mCounterTask = New Task("ciTask")
    mCounterTask.CIChannels.CreateFrequencyChannel( _
        "/Dev1/ctr0", "", 1.2, 500, CIFrequencyStartingEdge.Rising,
        CIFrequencyMeasurementMethod.LowFrequencyOneCounter,
        0.001, 32, CIFrequencyUnits.Hertz)
    mCounterReader = New CounterReader(mCounterTask.Stream)
    mCounterReader.SynchronizingObject = Me
    mCounterTask.Control(TaskAction.Verify)
    mCounterTask.CIChannels.Item(0).FrequencyTerminal = "/Dev1/pfi0"
    mCounterCallback = New AsyncCallback(AddressOf subCounterInCallback)

Sequence for reading the rpm measurements:
    'callback routine for rpm-measurement
    Private Sub subCounterInCallback(ByVal ar As IAsyncResult)
        Dim dblFreq As Double
        Try
            dblFreq = mCounterReader.EndReadSingleSampleDouble(ar)
            txtResult.Text = Format(dblFreq, "#,##0.000")
            Debug.WriteLine("Freq" & vbTab & Format(dblFreq, "#,##0.000"))
            mCounterReader.BeginReadSingleSampleDouble(mCounterCallback, Nothing)
        Catch ex As DaqException
            txtError.Text = ex.Message
            Debug.WriteLine(ex.Message)
            cmdStart_Click(Nothing, Nothing)
        End Try
    End Sub
0 Kudos
Message 1 of 5
(3,986 Views)
Hello Sievi,

First some facts...
These counters operate with TTL compatible signals. The definition of a TTL compatible signal is as follows:
0V - 0.8V = logic low
2V - 5V = logic high
Maximum Rise/Fall Time = 50ns
Minimum Pulse Width = 10 ns

National Instruments is using different counter chips with different features, timebases and resolutions.
The PCI-62xx and DAQCard 6062E has different counter chips. The chip in the PCI-62xx is the newer one and has more features like the chip in the DAQCard.

PCI-62xx
http://www.ni.com/pdf/manuals/371290f.pdf (page 9)

DAQCard 6062E
http://www.ni.com/pdf/manuals/370719c.pdf (page 9)

Your problem description looks like high frequency glitches or noisy signal.
On PCI-62xx there are digital filters to eliminate this but the counter in DAQCard do not support this.

Do you have twisted pair and shilded cables to the both boards?
If you creat the same signal like the rpm signal (you can generate the pulse train through the test panel for your device found in Measurement and Automation Explorer) with PCI-62xx counter and measure this signal with DAQCard... Do you get the same error?
Maybe you can solve the problem with an additional filter or refreshing signal by using a Or-TTL-Chip (put signal to both Or-Inputs and the output to the counter).

If you are looking for a portable solution with the equal counter chip you can use the NI USB-6220 or -6221.

Regards,
WolfgangZ

0 Kudos
Message 2 of 5
(3,973 Views)
Dear WolfgangZ,
 
thank you for your quick and informative reply.
 
According to your information I guess the problem is with the rise/fall time of my signal. As I wrote the input signal looks VERY clean on the oscilloscope, so I think I can exclude a noisy signal or high-frequency glitches. For reference I have included the oscillscope outputs as bitmaps in the attached ZIP file.
 
I am using the identical hardware configuration for both DAQ cards (except the DAQ card itself of course). My signal source (inductive initiator) goes to an opto-coupler which is connected to a TBX-68 screw terminal block (cable length approx. 5 cm). From here I use a shielded cable SHC68-68-EPM to connect either to the DAQCard-6062E or the NI PCI-6220. Everything is in a normal office environment (no electro-magnetic noise at all).
 
I will try the two solutions suggested by you (test with a TTL output of the DAQ card and/or using a TTL-chip between opto-coupler output and DAQ input) and let you know the result in a few days.
 
Thanks again and best regards,
Detlef S.
0 Kudos
Message 3 of 5
(3,933 Views)

...and here is the attachment.
Didn't know, that BMP are not allowed 😞

0 Kudos
Message 4 of 5
(3,886 Views)

We now have solved the problem which we had with the PFIx inputs of a DAQCard-6062E. It seems as if the input signals really have to be of a very good quality whereas the NI PCI-6220 can also work with a little bit less-quality signals.

For reference I have attached the input signals as a bitmap. Despite the very clean and noise-less signal obviously the rise and fall time of our signal seem to be the problem.

Following the suggestion of WolfgangZ (thank you for your help) we implemented a TTL chip (Schmitt trigger 74132) before feeding the signal to the DAQCard. Now both, the DAQCard-6062E and the NI PCI-6220, work perfectly.

Thanks and best regards,
Detlef

0 Kudos
Message 5 of 5
(3,882 Views)