Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

reading the _cjtemp in a scan

Hi I am trying to read temperture with a 9211 module. I have the following code set up as channels that I am adding to a scan...
 
   nNIStatus = DAQmxCreateAIVoltageChan(
      *pTH,
      "cDAQ3Mod1/_cjtemp",
      "",
      DAQmx_Val_Cfg_Default,
      -0.08,
      0.08,
      DAQmx_Val_Volts,
      NULL );
   if (CheckNIError(nNIStatus)) return(nNIStatus);
 
   nNIStatus = DAQmxCreateAIThrmcplChan(
      *pTH,
      "cDAQ3Mod1/ai0",
      "",
      -100.0,
      1000.0,
      DAQmx_Val_DegC,
      DAQmx_Val_J_Type_TC,
      DAQmx_Val_Chan,
      0.0,
      "cDAQ3Mod1/_cjtemp" );
   if (CheckNIError(nNIStatus)) return(nNIStatus);
It appears that I get only one value in my scan for these two channels and The value I get is 0.73? What am I doing wrong? I would be happy with just reading the CJC as a temperature and performing the conversions myself, but I cannot find where/how to get the temperature from the CJC?
 
Thanks,
 
John C
 
0 Kudos
Message 1 of 2
(6,656 Views)
Hi John,

Try one of the following two suggestions. First, you can remove DAQmxCreateAIVoltageChan from your task and let DAQmx access the built in CJC directly when setting up your DAQmxCreateAIThrmcplChan function. For this, set it up as follows:

DAQmxCreateAIThrmcplChan(*pTH,"cDAQ3Mod1/ai0","", -100.0, 1000.0,DAQmx_Val_DegC, DAQmx_Val_J_Type_TC, DAQmx_Val_BuiltIn, 0.0,"");

The other way is to take what you have but make a minor modification. Give your first virtual channel a name (in the third parameter) and then reference that name, instead of the physical channel, in the last parameter of your thermocouple channel. For example:

nNIStatus = DAQmxCreateAIVoltageChan(*pTH,"cDAQ3Mod1/_cjtemp","My CJC Value",DAQmx_Val_Cfg_Default,-0.08,0.08,DAQmx_Val_Volts,NULL );

if (CheckNIError(nNIStatus)) return(nNIStatus);
 
nNIStatus = DAQmxCreateAIThrmcplChan(*pTH,"cDAQ3Mod1/ai0","",-100.0,1000.0,DAQmx_Val_DegC,DAQmx_Val_J_Type_TC,DAQmx_Val_Chan,0.0,"My CJC Value" );

if (CheckNIError(nNIStatus)) return(nNIStatus);
PBear
NI RF
0 Kudos
Message 2 of 2
(6,643 Views)