Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Temperature is sporatic

I have a class that establishes a task, an AIChannel and a Reader to read the temperature off of a NI-TC01. It works but sometimes the temperature is 0.0 unless I close the solution in Visual Studio 2013 an reopen it. Then when I run (in debug mode) the program again the temperature is correct, at least for a while. I am not sure what is changing. The class is running on a background thread that reports the temperature every 2 seconds. Just wondering if any one was aware of something the task does or the channel that would make one or the other stop. And if that was the case then why not restart when the program is restarted? 

 

Just searching for ideas.

0 Kudos
Message 1 of 4
(2,662 Views)

Hey ScottinTexas,

 

Have you tried to get this working with an example to rule out whether it is hardware or software?

 

 

Where Are NI-DAQmx Examples Installed? - http://digital.ni.com/public.nsf/allkb/E3BAF6FC4017960B8625755A00525D37

JY
Application Engineer, RF and Communications
National Instruments
0 Kudos
Message 2 of 4
(2,621 Views)

yamadj,

Thank you for your response.

No I haven't tried one of the examples until just a second ago. I didn't know they were installed! Unfortunately the Dot Net 4.5 C# example does not run. It gives me an error on Sample Timing Type. I may study it further later. My code works, but just not consistently. Sometime the temperature comes up as 0.0 when I know it is 22. When that happens I close Visual Studio and reopen it with my project. Then the temperature reads correctly. I can test run my project several times and the temperature will continue to read properly. Then I will notice that it is back on 0.0. Maybe the channel is not properly disposed of when I exit the program. Then when I run it again it is still assigned to a thread that is no longer alive. I don't know. Maybe someone here has an idea.

0 Kudos
Message 3 of 4
(2,617 Views)

Hello ScottinTexas,

 

Thus far I can't pinpoint anything specifically to be the root cause of what is causing your behavior. As for the example not working I believe that is because in that example it expects the device to have an onboard clock which I don't think that your device has.

 

Moving forward I suspect that it is possible that your current applciation might not be handling the resources/handle for the device properly but it is hard to know excatly where from just the behavior.

 

Could we try this other example to see if we can get less sporadic readings? 

 

Path - C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DotNET4.5.1\Analog In\Measure Voltage\AcqMultVoltageSamples_SWTimed\CS

 

This example is pretty simple and won't get temprature, but it is useful for comparing against since I know that running this code shouldn't exhibit those inconsitentcies. Also you can look at this code versus yours to see if you are disposing of the task properly as well.

 

If the behavior follows and persists in the example it is possible that it could be with our hardware instead of our software.

JY
Application Engineer, RF and Communications
National Instruments
0 Kudos
Message 4 of 4
(2,611 Views)