Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to set R0 value after getting the sample clock rate

Hi,

 

I am trying to take a 4 wire RTD temperature measurement using a NI 9219 module on a cDAQ 9178.

 

I would like to make certain that I am using the recommended physical setup correctly and making the correct sequence of API calls (Please see attached C program). In order to troubleshoot my setup, I am using a fixed resistance (with nominal value of 1K ohm) instead of a Pt3851, connected as follows:
EX+ connected to HI
EX- connected to LOW
A 1000ohm resistor between EX+ and EX-

 

If I set the R0 value to be 1000, I expect the value of the output of DAQmxReadAnalogF64 to be close to 0 according to Callendar-Van Dusen Equation.

 

Here is my problem:
My attached program creates the RTD channel with a default R0 value of 100 and then later changes it to 1000 using the DAQmxSetAIRTDR0 method. If I call this method after a call to DAQmxGetSampClkRate, I get incorrect results (~ -123.91). If I move line 74 of the attached C program to a line above line 71, or if I remove line 71, I get expected results (~ 0.62). By calling the DAQmxGetSampClkRate function, am I sending the task to a state where it does not respond to property changes? The attached program is only a dummy program to illustrate the issue. In my application I use the sample clock rate to configure other properties.

 

Why does this happen? Is there a way around this?

 

Thanks,
Varun Hariharan
MathWorks

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

Maybe I'm misunderstanding, but it looks like you included the workaround/solution in your problem statement:

 

"If I move line 74 of the attached C program to a line above line 71 . . . I get expected results (~ 0.62)."

Highest Regards,

Paul
0 Kudos
Message 2 of 6
(3,827 Views)

Hi,

 

The program I attached was only an example program and my actual application workflow requires the possibility of retrieving the sample clock rate before setting the R0 value. I am trying to understand the reason behind the difference in results and if the task state plays a part in this. 

 

Thanks,

Varun Hariharan

MathWorks

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

Hi vharihar

 

 

I was reading your code and I saw that you are using the get sample clock function between the create and the start task function.

What happen if you move this function outside of this task?

 

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

Hi,

 

If I called the DAQmxGetSampClkRate after the start task or if I do not call it at all, then the R0 value gets configured correctly. 

 

Regards,

Varun Hariharan

MathWorks

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

Hello, 

 

Can I get an update on this? Is there a way to set the R0 value after retrieving the sample clock rate? Should the task be in a particular state in order to set the R0 value? 

 

Thanks,

Varun Hariharan

MathWorks

0 Kudos
Message 6 of 6
(2,821 Views)