Coder Social home page Coder Social logo

Comments (4)

jeffreyg3 avatar jeffreyg3 commented on May 9, 2024

Attached is an all Linux example featuring the USB-2408-2AO, running ulTIn() in a 250 mS continuous loop (I have also run this at 500 mS and 100 mS sleep). Granted I am showing the data in degrees F. It does not show the aberration you are seeing.
Note that since this function returns static values (not data returned in an array) there really is no sample rate supplied to the ulTIn function, that is a 'function' of the sleep() timer. There is a data RATE parameter but that is set for settling time for the 24 bit A/D converter. Not to be confused with Sample Rate. to be clear, Sample Rate is not the same as Data Rate.
2408_TIn.zip

from uldaq.

MarkRivers avatar MarkRivers commented on May 9, 2024

@jeffreyg3 I fully understand the difference between the rate at which I read the temperature (controlled by sleep) and the data rate, which is the averaging time in the 2408. It is controlled by this function call:

 err = ulAISetConfigDbl(devHandle, AI_CFG_CHAN_DATA_RATE, 0, dataRate);

This dataRate is what I was calling samplingRate, which may be the source of the confusion.

As you will recall from another recent issue I had on Linux it is necessary to set AI_CFG_CHAN_DATA_RATE because it is not read from the non-volatile memory (as it is on Windows) and defaults to a very short time which leads to very noisy temperature measurements.

My issue that that if I set dataRate to 60 it works fine. If I set it to 20 or less it works fine on Windows, but returns occasional spurious values on Linux. I have an application where I am seeing noise on the thermocouple with 60 Hz data rate, so I want to increase the averaging in the device by slowing down the data rate.

Please run the test program in the link in my original message and I am sure you will reproduce the problem.

from uldaq.

jeffreyg3 avatar jeffreyg3 commented on May 9, 2024

@MarkRivers per our off github conversations, this issue has been resolved to your satisfaction.
Please close this thread/topic.

from uldaq.

MarkRivers avatar MarkRivers commented on May 9, 2024

This problem is due to the cold junction compensation (CJC) value occasionally being read incorrectly from the device. This problem was observed on Ubuntu 18 and Centos 8.

The following is a workaround which adds a 100 microsecond sleep in AiUsb24xx::updateCjcValues().


corvette:~/devel/libuldaq-1.2.1>git diff
diff --git a/src/usb/ai/AiUsb24xx.cpp b/src/usb/ai/AiUsb24xx.cpp
index 38a3aa9..9341c71 100644
--- a/src/usb/ai/AiUsb24xx.cpp
+++ b/src/usb/ai/AiUsb24xx.cpp
@@ -534,6 +534,8 @@ void AiUsb24xx::updateCjcValues()
        if(daqDev().getDeviceType() == DaqDeviceId::USB_2416 || daqDev().getDeviceType() == DaqDeviceId::USB_2416_4AO)
                dataCount = 8;

+  // This usleep call is needed on Intel processors, otherwise occasionally the first 1 or 2 bytes of the CJC response are 0xFF so the value is
+  usleep(100);
        daqDev().queryCmd(CMD_CJC, 0, 0, (unsigned char*) &data, dataCount * sizeof(short));

Measurement Computing should decide if this is the correct fix, or whether some other change should be made.

from uldaq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.