McKenzie

erroneous data when reading frequency with Labjack T4

Recommended Posts

I am encountering erroneous frequency data when reading frequency with labjack T4. I am using DAQ factory express.

Initially I encountered this in a real application, but I have been able to duplicate it in a simple .ctl, which is attached.

I am reading frquency on FIO4 using the time interval method (time between rising edges). I display the result (after some calculations) and also graph the result. I am also sampling three analog channels. In experimentation I have noticed that the problem seems to go away when I delete the three analog channels. Is there any reason why the analog read operations would interfere with the read to FIO4?

As far as my test setup goes, I am testing using a function generator to supply 100 Hz square wave to FIO4. I have probed it with an oscilloscope and it is a very clean signal. I do not suspect noise is any part of the problem.

I have tried it on two T4 devices, and they both behaved the same way.

I also attached a screenshot of the ctl file "in action." RPM is calculated from the FIO4. Basically RPM is proportional to frequency. The correct result SHOULD be 600 RPM. But often I see much higher frequencies (corresponding to shorter intervals) which are not correct.

Any help or suggestions would be much appreciated.

 

 

quick_freq_test_with_ADC.ctl

screenshot.png

Share this post


Link to post
Share on other sites

I'll let LabJack comment, but I will say this: you really should use the same identifier in both your channels and your script.  Otherwise DAQFactory thinks you are connecting to two different devices and will ask the LJM driver for two different connections to your single device.  Probably not the cause here, but just a pointer.

Share this post


Link to post
Share on other sites

Reading the AIN should not influence the digital features of the T4 unless you are using stream mode, in which case your maximum edge rate would drop.

Before anything else, please ensure you are using the most recent release version of firmware. This is easiest to check using the Device Updater tab of Kipling. Also install the latest version of LJM. See our LJM installer page:

https://labjack.com/support/software/installers/ljm

I would recommend you start troubleshooting by closing DAQFactory and configuring the frequency in feature in Kipling as described in the guide below. Add your AIN channels to the active registers just so that everything is consistent with your current program:

https://labjack.com/support/software/applications/t-series/kipling/register-matrix/configuring-reading-frequency

If you do not have the issue in Kipling, that suggests something going on in your program. Otherwise there is likely something going on at a hardware level.

Another good test would be to connect FIO4 to DAC1 and write a 1 to the register  DAC1_FREQUENCY_OUT_ENABLE. This will generate a 10Hz square wave on DAC1 that the frequency in feature should agree with. The DAC1 frequency out function is described in our T-series datasheet:

https://labjack.com/support/datasheets/t-series/dac

Share this post


Link to post
Share on other sites

I have not used Kipling. I will try to do that. I do have the latest LJM Installer (I checked that before I came here to the forum).

In the short term I have switched to using counter instead of timer. I just continuously count the pulses and then reconstruct the frequency in post processing after logging. This may end up being a workable solution for me.

Please be reminded that I ran the program with a function generator as input, and monitored the signal with an oscilloscope to confirm good signal integrity. So I don't see much point in using DAC1 to generate a "known good" waveform. But thank you for the suggestion anyway.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now