Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Thermocouple channels stay differential once you assign them

I just spent a good hour cussing about this.

 

I connected a thermocouple (K type) via extention rated cable straight into a PCI6289 via SCC-68 (without a thermocouple module).

 

The measurement was extremely noisy; jumping from -40 to 150 F. So I set it up for differential. In VB.NET, I created a thermocouple channel and after that set its connection type to differential. There wasn't much difference in the signal.

 

In playing around with MAX I found out there's a lowpass filter onboard. I created a task to test it and with it on the temperature measurements were acceptable. So I decided to change the connection back to single ended, and I deleted the line of code that set it to differential.

 

Then I started getting temperatures values stuck at 6.3k (yes, that's thousands of degrees F). When measuring as a voltage channel, things were as expected (few millivolts jumping around) but as a thermocouple channel it would be stuck to 6.3k---both in my code and in MAX. I reset the board (in MAX), rebooted the computer, finally powered it down for about 20 seconds, and nothing. Still the same behavior.

 

I reconnected the thermocouple in differential mode and it worked. Then I realized---the differential pair's second channel is floating when I change this to single ended.

 

It turns out the DAQ system somehow remembers that the thermocouple channel was differential, EVEN AFTER A POWER DOWN OF THE COMPUTER, unless you EXPLICITLY CALL IT OUT TO BE SINGLE ENDED. So now my code works fine as long as I explicitly requtest an RSE connection type after creating the channel.

 

Unbelievably (to me, at least), in MAX I can now no longer create a thermocouple channel on that physical channel, becuase in MAX you cannot explicitly say if you want it to be differential or single ended and so it's "stuck" measuring relative to a floating channel.

 

Unbelievable!

 

And after all this, it seems that from VB.NET the analog filter does jack and squat.

 

Glad we paid $7k for all this crap.

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

All of the behavior you are seeing is expected. The default mode of the card is differential measurements so it makes sense that you have to explicitly set it to single ended. Selecting a thermocouple measurement automatically sets the card to take a differential measurement. That is what should work and what has worked for me. Sounds like you might have some wiring problems. How did you wire it for a single ended voltage measurement? And do you have the cjc on the scc-68 wired?

 

The filter on the board is a 40kHz lowpass. What was the frequency of the noise.

0 Kudos
Message 2 of 6
(3,879 Views)

Regarding single-ended/differential:

1. When you create a thermocouple channel, it is single ended. You *must* excplicitly change it to differential (if that's what you want) in a separate line of code.

2. In MAX, you can't even create a differential thermocouple channel.

3. Everything was working fine (in single ended mode) until I changed it to differential. After that, it seems I now must explicitly call for single ended or it will "default" to differential and measure relative to a floating channel.

4. These problems do not exist if I create a voltage channel instead, but I suspect it's because when you create one you must explicitly call for the connection type.

 

Regarding the filter:

1. With the filter turned off the temperature is all over the place.

2. In MAX, if I enable the low pass filter I get a good enough measurement of the temperature.

3. In DAQmx .NET enabling the filter does nothing---and it lets you set a cutoff frequency, so I figured it was a digital filter done in "post processing" somewhere inside the DAQmx library (just like the conversion from voltage to temperature is done hidden away somewhere when you create a thermocouple channel). Moreover, it seems the filter is a channel property, but when you verify the task it tells you all the channels have to have the same value. So that requires me to write a for-loop to cycle through all the channels to make the filter properties the same? Seems dumb.

 

Regarding physical connections:

1. The connections are correct.

2. In differential mode I see a slight improvement---but it's not worth consuming another channel, so I'm going back to single ended.

 

Regarding CJC:

1. That part of it is irrelevant right now. I don't have it wired yet; my main concern here is the strange behavior I'm seeing that all of a sudden I have to explicitly declare a thermocouple channel to be single ended.

 

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

I see just the opposite behavior. As soon as I create a thermocouple task in MAX, it shows as differential on the Connection Diagram. You can't create a single ended thermocouple task.

 

The filter is not 'digital' as you can see in the manual.

0 Kudos
Message 4 of 6
(3,871 Views)

Interesting regarding MAX forcing it to be differential. As I understood it the default behavior in .NET is single ended. If I'm wrong, then that's the case. But I did not see this behavior until I forced it to be differential....

 

It takes me longer to find out which manual/help file to look at than to just cuss at the problem until I figure it out.

0 Kudos
Message 5 of 6
(3,862 Views)

Hi pelesl,

 

I understand that this is frustrating. DAQmx doesn't remember what channel settings you used with a previous task, and sometimes people expect it to remember, but I think the inconsistent behavior you are seeing is more related to how DAQmx chooses the default value for various properties.

 

> 1. When you create a thermocouple channel, it is single ended. You *must* excplicitly change it to differential (if that's what you want) in a separate line of code.

 

For AIChannel.TerminalConfiguration on M Series, DAQmx chooses the default value based on which physical channel you are using. ai0:7 and ai16:23 use Differential by default, but ai8:15 and ai24:31 don't support Differential so they use Rse by default.

 

To see what the default value for this property is, verify the task and get the property:

 

                myTask.Control(TaskAction.Verify);

                foreach (AIChannel ch in myTask.AIChannels)
                {
                    AITerminalConfiguration termCfg = ch.TerminalConfiguration;
                    int x = 0; // breakpoint here
                }

 

The debugger should show termCfg=Differential for ai0:7 and ai16:23, and termCfg=Rse for ai8:15 and ai24:31.

 

> 2. In MAX, you can't even create a differential thermocouple channel.

 

The thermocouple versions of DAQmx Create Channel and the DAQ Assistant thermocouple settings were designed for SCXI thermocouple modules (which all have fixed terminal configuration), so they don't include the terminal configuration property. As a result, you can't change the terminal configuration from the default. The default isn't Rse in all cases: it's device-dependent and often channel-dependent.

 

> 3. Everything was working fine (in single ended mode) until I changed it to differential. After that, it seems I now must explicitly call for single ended or it will "default" to differential and measure relative to a floating channel.

 

Did you also switch to a different physical channel? (e.g. change from ai8 to ai0?)

 

> 3. In DAQmx .NET enabling the filter does nothing---and it lets you set a cutoff frequency, so I figured it was a digital filter done in "post processing" somewhere inside the DAQmx library (just like the conversion from voltage to temperature is done hidden away somewhere when you create a thermocouple channel). Moreover, it seems the filter is a channel property, but when you verify the task it tells you all the channels have to have the same value. So that requires me to write a for-loop to cycle through all the channels to make the filter properties the same? Seems dumb.

 

The NI 628x has a hardware lowpass filter with a fixed cutoff. However, the DAQmx filter properties were designed to support SCXI modules that have independent filters per channel and configurable cutoff frequencies, so yes, you must set the cutoff frequency to be the same value on each channel. However, you don't need a for-loop to set properties on multiple channels. In LabVIEW or C you can use activeChannels="" and in .NET you can use AIChannels.All:

 

                myTask.AIChannels.All.LowpassCutoffFrequency = 40000.0;
                myTask.AIChannels.All.LowpassEnable = true;

 

What happens if you set the cutoff frequency to something else? DAQmx either errors (if the cutoff frequency is too high) or coerces it to the next best supported value. A few SCXI modules have switched capacitor filters that support thousands of filter cutoff frequencies, so coercion is helpful in some cases, but in hindsight it turned out to be a bit confusing for devices that only support one cutoff frequency. However, the behavior is unlikely to ever change for already shipping devices like the NI 628x, because changing it might break users' applications.

 

When DAQmx coerces properties, you can see what it did by verifying the task and getting the values of the properties, like I described for TerminalConfiguration.

 

> It takes me longer to find out which manual/help file to look at than to just cuss at the problem until I figure it out.

 

The NI 628x Specifications and the M Series User Manual should be the final word regarding what the hardware can do. The NI-DAQmx Help covers high-level DAQmx programming concepts (including property coercion) and some device-specific information about the APIs and properties, but for the most part, it doesn't overlap with the device user manuals and specifications. And the DAQmx .NET Help covers the various classes, methods, and properties, but it doesn't cover the high-level DAQmx programming concepts (that's in the NI-DAQmx Help) or the device-specific info (that's in the device user manual and specifications).

 

If you have a constructive suggestion on how to make this better (no cussing 🙂 ), please post it to the DAQ Idea Exchange.

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 6 of 6
(3,850 Views)