LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the CPU temperature

How can I get the CPU temperature in a realtime application?

I have seen the NI System Monitor package, but it seems very limited only supporting a few CPU cards.

Is there a way to maybe read it out straight from the MSR?

I am using LabWindows/CVI 2012 with a PXI running LabView realtime as a realtime target.

0 Kudos
Message 1 of 13
(3,671 Views)

NI has the System Control library that lets you query a lot of things of your system. It may not come with a LabWindows CVI instrument library front panel file but certainly has a header file and import library that you can use in your code. It may not support every possible feature of every computer system but has a lot of things to query that work across various OSes all the same.

 

If you can’t do what you want with this library it gets all very hairy. Each OS is totally different in what and how you can query things, if you even can!

Rolf Kalbermatter
My Blog
Message 2 of 13
(3,644 Views)

Can WMI be a solution for your needs? If so you could read this StackOverflow thread and experiment it with my code on using WMI



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 13
(3,636 Views)

@RobertoBozzolo wrote:

Can WMI be a solution for your needs? If so you could read this StackOverflow thread and experiment it with my code on using WMI


I noticed a “realtime” in that post. It may not mean NI Phar Lap ETS realtime but if it does, WMI is not even remotely an option. But the NI System Control API is available on all platforms  Ni currently supports including all realtime platforms, Windows and Linux (maybe MacOS too, not sure about that).

 

Accessing it directly by reading CPU registers is most likely not possible as many of those special opcodes are privileged, meaning they can only be called from a Ring0 context, meaning from inside the kernel. Also depending on the compiler it may not support inline assembly or compiler intrinsics. Not sure about CVI but I doubt it does.

Rolf Kalbermatter
My Blog
Message 4 of 13
(3,630 Views)

@rolfk wrote:

NI has the System Control libray


Could you please provide a link to it? I have been looking for it everywhere but no luck.

 

And yes, I am developing for a Phar Lap ETS Real-Time target, so WMI is unfortunately not an option for me.

0 Kudos
Message 5 of 13
(3,592 Views)

@rolfk wrote:


Accessing it directly by reading CPU registers is most likely not possible as many of those special opcodes are privileged, meaning they can only be called from a Ring0 context, meaning from inside the kernel.


 Yes, I am aware of that. I was thinking if maybe I was able to write a simple kernel mode driver that would read the register and return the value, but have not found any useful resource to even get started with it.

 


@rolfk wrote:

Also depending on the compiler it may not support inline assembly or compiler intrinsics. Not sure about CVI but I doubt it does.


It does not, but I can write it in assembly and link it to the project, so that is not a big problem.

0 Kudos
Message 6 of 13
(3,588 Views)

@Laci0503 wrote:

@rolfk wrote:

NI has the System Control libray


Could you please provide a link to it? I have been looking for it everywhere but no luck.


https://www.ni.com/en/support/downloads/drivers/download.system-configuration.html#371210

As mentioned, I’m not sure it comes with native LabWindows CVI support. But it absolutely comes with External C compiler support for MSVC and you can always link that in your CVI project.

 

To get your realtime app be able to call this API you have to make sure the according support is installed on the target. Go into NI-Max, find your target and check the installed software. Select “Add additional software” if you don’t find it already installed.

 

Device driver development for Phar Lap ETS is an option that has long passed away. The necessary SDK was very expensive but since Interval Zero EOLed Phar Lap ETS in 2013 you can’t obtain it anymore even if you want to shelf out that much money.

Rolf Kalbermatter
My Blog
Message 7 of 13
(3,575 Views)

@rolfk wrote:

@Laci0503 wrote:

@rolfk wrote:

NI has the System Control libray


Could you please provide a link to it? I have been looking for it everywhere but no luck.


https://www.ni.com/en/support/downloads/drivers/download.system-configuration.html#371210

As mentioned, I’m not sure it comes with native LabWindows CVI support. But it absolutely comes with External C compiler support for MSVC and you can always link that in your CVI project.

 

To get your realtime app be able to call this API you have to make sure the according support is installed on the target. Go into NI-Max, find your target and check the installed software. Select “Add additional software” if you don’t find it already installed.


Okay, thanks!

I have found this site, but I was not sure that this is what you mentioned.

I'll post an update when I have some news.

0 Kudos
Message 8 of 13
(3,573 Views)

Hi,

I am testing the NI System Configuration API on my host machine, and I can extract the CPU core count and the CPU name, but not the CPU temperature.

My cpu is Intel Core I3-7100 @ 3.90GHz. I'm running Windows 10.

Is my cpu not supported? If yes, is there a list of supported hardware?

 

Best regards,

Laci

0 Kudos
Message 9 of 13
(3,550 Views)

What type of sensors are supported and which varies greatly per OS. I’ve mostly used it on NI sbRIO hardware where it supports several temperature sensors including in the FPGA itself.

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 13
(3,538 Views)