Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Temperature measurement with the PCI-6229

Solved!
Go to solution

I was posting in an old thread and not getting and response, so I thought I try a new one.

 

Link to old thread: http://forums.ni.com/ni/board/message?board.id=250&thread.id=14920&view=by_date_ascending&page=1

 

I'm trying to measure temperatures using thermocouples using the PCI-6229 and I am using two SBC-68LPR's to make the connections.  These don't have reference junctions on them.

 

After settling down enugh to carefully read through the old thread I mentioned above I think I figured out what I need to do.  Here's what I am doing now:

 

Create a task - DAQmxCreateTask

Create a thermistor channel for this task - DAQmxCreateAIThrmstrChanVex

Create a number of thermocouple channels for this task (DAQmxCreateAIThrmcplChan) using the cjcsource option DAQmx_Val_Chan and specifying the thermistor channel as the source channel

Start this task - DAQmxStartTask

Get the temperatures - DAQmxReadAnalogF64

Stop the task - DAQmxStopTask

Clear the task -DAQmxClearTask

 

I don't have anything hooked up yet but I doubt that is the cause of the error.

 

A few more details (pardon my Delphi):

 

Creating the thermistor channel

TmPcName:='Dev1/ai19';

 

iStatus:=DAQmxCreateAIThrmstrChanVex(
      TcTaskHandle,                 // Task handle
      @TmPcName,                 // Physical channel name
      @TmChName,                 // Channel name
      -80,                                   // Min range
      80,                                    // Max range
      DAQmx_Val_DegC,        // Units, °C
      DAQmx_Val_ResistanceConfiguration_4Wire,  // 2-wire, 4-wire, etc.
      DAQmx_Val_ExcitationSource_External,      // Excitation source, external
      1,                                     // Excitation value
      9.376e-4,                         // a
      2.208e-4,                         // b
      1.276e-7,                         // c
      30000);                            // Reference resistor
 

Creating the thermocouple channel:

TcPcName:='Dev1/ai23';

 

iStatus:=DAQmxCreateAIThrmcplChan(
      TcTaskHandle,               // Task handle
      @TcPcName,                // Physical channel name
      '',                                     // Channel name
      0,                                    // Min range
      1000,                              // Max range
      DAQmx_Val_DegC,      // Units
      DAQmx_Val_DegC,      // Thermocouple type
      DAQmx_Val_Chan,       // CJC source
      25,                                  // CJC value, if DAQxm_Val_ConstVal
      @TmPcName);             // CJC channel, if DAQxm_Val_Chan
 

It looks like 4-wire configuration is required for voltage excitation thermistor measurements.

 

Also, it looks like external excitation is required in my case, PCI-6229.

 

Everything is working if I use a CJCConstant.  WHen I do this I use the same code to create teh thermocouple channels, but I skip creating the thermistor channel.  When I try using a CJCChannel I get an error saying "Requested value is not a supported value for this property.", which occurs when I call DAQmxStartTask.  I have no idea which property this message is referring to and as best as I can tell the properties I've specified make sense.  THe termistor constants were taken from a real thermistor I found on Omega.com.

 

I could also use some help figuring out how to hook up the thermistor.  It looks like I need to fab up a thermistor circuit myself, with a stable voltage reference to power the termistor, and use a double-ended analog-in channel.

 

Thanks,

Mike

 

0 Kudos
Message 1 of 7
(4,812 Views)

Mike,

 

Thank you for posting on the NI Forums. The reason that you are getting that error when you run your task without specifying a CJCConstant value is because that is the only supported property for the 6229. Some of our other cards have a built in CJC source, but not this card. When using it with a thermocouple you will have to give a constant CJC value for the temperature to be calculated correctly. Hope this helps, let me know if you have any other questions. 

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 2 of 7
(4,793 Views)

Thank you for the reply.

 

I understand that there are three options for the CJC source.  From the NIDAQmx C reference:

 

Value
Description
DAQmx_Val_BuiltIn   Use a cold-junction compensation channel built into the terminal block.
DAQmx_Val_ConstVal   You must specify the cold-junction temperature.
DAQmx_Val_Chan   Use a channel for cold-junction compensation.

 

I also understand that the first option, built-in CJC, is not available, which makes sense because the thermcouples will be connected at the other end of the cables.  The ConstVal option is working for me, but that is a very unappealing option since I'd have to clear and recreate the task each time I measure the temperature, of maybe I can just reconfigure the channels with the new CJC values.  But my understanding was that the Chan option is available, per Tom W.'s (N.I. engineer) postin the link I gave above.

 

[quote="Tom W."]The NI 6220 only supports constant values and CJC routed through channels on the board.  If you are using an SCB-68 terminal block you can route the CJC sensor to either differential or single-ended channel 0 depending on your needs by configuring the switches as indicated in the user manual.[/quote]

 

Tom's comments were for the 6220 board, but it doesn't seem like that should be different for the 6229 board.

 

Are you sure the Chan option is not available for the 6229?

 

0 Kudos
Message 3 of 7
(4,785 Views)

Mike,

 

I believe your right and that if it would be possible with the 6220 it would be possible with the 6229 as well. I didn't put it together that you were using the SCB-68 as well. I would follow what Tom suggested in that post. You might try configuring the 6229 to use the SCB-68 Connector Block. You can do this in Measurement and Automation Explorer, and with your 6229 highlighted select "Properties" from the tabs to the right of "Configuration". This will open the Device Properties, and one of the tabs is "Accessory" where you can select your connector block. This may help, try that and let me know. 

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 4 of 7
(4,759 Views)

Thanks for the reply, and sorry for the delay following up.

 

I'm actually using the CB-68LPR, or rather two of them.  I'll go ahead and build my own thermistor temeprature sensor and will plug that in.

 

I guess my question now is what option am I setting wrong?  I've set up a task where on channel is a thermistor channel and the rest are thermocouple channels and it all looks OK to me, but I'm getting that error message that says some option is not available.  Looks like I'll be going with the trial-error methoid to try to figure it out.

 

0 Kudos
Message 5 of 7
(4,713 Views)

Hi m610,

 

I'm not exactly sure why this isn't working at the moment, but it looks like one input parameter to your  Status:=DAQmxCreateAIThrmcplChan() function call is not specified correctly. For the line that says  DAQmx_Val_DegC,      // Thermocouple type, you need to specify the type of thermocouple aka something like DAQmx_Val_J_Type_TC,etc. as shown in the NI-DAQmx C Reference Help.

 

This may have something to do with the error. I know it should throw an error if this is specified this way, however, I'm not sure if that explains the exact error you're getting. I think one good way to troubleshoot this, is to take the coding out of the equation and create a task in Measurement and Automation Explorer (MAX) to perform this task. If you right click on your PCI-6229 in MAX and select Create NI-DAQmx Task and then create a task that has one thermistor input, configured the way you specified in your code, and then add one of your thermocouple channels and try to run that in MAX. This could rule out whether there is actually a problem with using this configuration or whether we just need to fix the code. I have attached a picture of the task that I set up in MAX. I can't actually test it because I don't have the hardware to do so, but hopefully it will be a good test for you. 

 

Chris W

0 Kudos
Message 6 of 7
(4,687 Views)
Solution
Accepted by topic author m610

The thermocouple-type error was a type-o in the post.   Thanks for catching it.

 

I think I found the problem. 

 

I wrote a little test program just for thermistors, and I switched from using the voltage exctation routine to a current excitation routine (...Iex instead of ... Vex).  I had been specifying a minimum value that was less than 0.  I changed it from -80 to 0 and it is now working.  Still, I have gotten a divide-by-zero error, intermittantly, when reading a thermistor channel.  The error is not in my code.  It occurs when calling DAQmxReadAnalogF64 for the first time and I don't do any math related to that call.  I'm still looking into it.

Message Edited by m610 on 05-17-2009 08:43 PM
0 Kudos
Message 7 of 7
(4,650 Views)