04-07-2010 02:44 PM
I have used a NI 9219 in combination with some RTDs to measure temperature in the past. I configured the channels using the code below. I am trying to use a 9217 now, but it doesn't seem as though the configuration is the same. When using the same code as before, it returns NaN. When using MAX, it returns the resistance. The 9219 would return a temperature. How do I configure the channel for an RTD using the 9217? What do I need to do to get temperature from the value returned by the 9217.
Thanks
Case Is = "3750" Tasks(TaskCount).AIChannels.CreateRtdChannel(.Device & "/" & .Channel, "ai" & .Device & .Channel, _ Convert.ToDouble(.Min), Convert.ToDouble(.Max), _ AITemperatureUnits.DegreesC, AIRtdType.Pt3750, AIResistanceConfiguration.FourWire, _ AIExcitationSource.Internal, Convert.ToDouble(0.001), _ Convert.ToDouble(.Report))
04-08-2010 11:11 AM
Hi Michael,
It appears you are looking to do a 4-Wire RTD measurement using the 9217. Also, it seems you were able to successfully do this using a 9219 before using the same syntax, is that so? When you refer to reading in the value in MAX as a resistance, I am a little confused. I know that it is possible to configure a DAQmx RTD task in MAX for this module that will return a value in DegC. Have you tried this in MAX?
Here are a few documents to review about the physical connections:
How Do I connect 2,3, and 4 Wire RTDs to My Data Acquisition Card?:
http://digital.ni.com/public.nsf/allkb/5BFB36CFCC32C662862570D5006DC0C0
The NI 9127 and NI 9219 2-Wire RTD Support:
http://digital.ni.com/public.nsf/allkb/09E99F60C481D613862572C300637341
It also appears that you are programming in .NET. Are you using VB.NET or C#.NET? We do provide a C reference help for DAQmx, and the syntax is very similar to that of .NET. It can be found by navigating to Start»Program Files»National Instruments»NI-DAQ»Text-based Support. There are also Examples for .NET located here. The topic I searched for in the C Reference Help was "DAQmxCreateAIRTDChan."
Also, the examples folder as mentioned above contains a shipping example titled ContAcqRTDSamples_IntClk. Within this folder you can find an example for C# (CS) and for Visual Basic. Please try out this example to see if it works for your application, and then you could use the code for the task setup in your code.
Here is the code from the c# example:
myTask.AIChannels.CreateRtdChannel(physicalChannelComboBox.Text,"",
Convert.ToDouble(minimumValueNumeric.Value), Convert.ToDouble(maximumValueNumeric.Value),
AITemperatureUnits.DegreesC, rtdType, resistanceConfiguration, excitationSource,Convert.ToDouble(currentExcitationNumeric.Value), Convert.ToDouble(r0Numeric.Value));
Here is the code for Visual Basic:
myTask.AIChannels.CreateRtdChannel(physicalChannelComboBox.Text, "", _
Convert.ToDouble(minimumValueNumeric.Value), Convert.ToDouble(maximumValueNumeric.Value), _
AITemperatureUnits.DegreesC, rtdType, resistanceConfiguration, _
excitationSource, Convert.ToDouble(currentValueNumeric.Value), _
Convert.ToDouble(r0Numeric.Value))
Please let me know if I have misunderstood or overlooked anything in your post.
Best,
04-08-2010 12:49 PM
It is possible that the engineer hooked up the 4-wire RTD incorrectly. It was returning ~109-111 using MAX. If I rubbed it it would increase, but not by much. I don't see a place in max to specify the RTD type or R0, however, so I'm nore sure what it returns and how calibrated that value is.
In what case would DAQmx return NaN when trying to read an RTD? I got my code from the Measurement Studio samples, and it looks just like what you have provided.
04-08-2010 03:02 PM
Hi Michael,
I just finished simulating a cDAQ 9172 chassis with a 9217 in slot 1. I then proceeded to use the Visual Basic Example that was mentioned before in my post. I had to change the current excitation source to be internal and the value to be 1mAmp. This was because it threw Error -200077: this value is not supported. After changing those values, I was able to receive working values back from the VB Main Form splash screen.
With that said, the NaN could be coming from the external connections not working correctly. If you could, please try to simulate a cDAQ chassis (9172, 9174, 9178) in MAX and then configure the chassis to have a 9217 in slot 1 of the chassis.This can be done in MAX by right-clicking on Devices and Interfaces and selecting Create New...»DAQmx Simulated Device»9172, 9174 or 9178.
You can then create a DAQmx Task in MAX by right clicking on the cDAQ 9217 Device that is now listed underneath the cDAQ chassis and selecting Create Task.... Then proceed to create an Analog Input»Temperature»RTD task, and configure it accordingly. Once you get the task created, you should see a window similar to the image below where you can change the RTD type, excitation type, etc.
Let us know how it goes after simulating a device in MAX.
Best,
04-12-2010 09:32 AM
Bad programming on my part. I grabbed an available variable to use for R0 and that variable's type happened to be boolean. A 1 or -1 was not a proper value for R0, hence the NaN. Problem solved, and it works with the same code that I used on the NI 9219.
Thanks for your help. Sorry about the waste of time!