News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Read CPU Temperature

Started by Rusica, April 29, 2014, 10:45:38 PM

Previous topic - Next topic

Rusica

Hi,
I have a project to do where I must display the CPU temperature. How should I do this?
Here I have a window wich has a timer and I need to display the CPU temperature too.
Thanks

Gunther

Hi Rusica,

first things first: welcome to the forum.

To your question. That's a bit tricky. You have to check the temperature feature with the CPUID instruction. Set EAX = 1 and check the bit 22 of register EDX. Details could you find here.

Gunther
You have to know the facts before you can distort them.

Rusica

Thanks, but it's a bit harder for me, because I didn't work with masm before. I am a "rookie", but I want to learn.

Gunther

Hi Rusica,

Quote from: Rusica on April 30, 2014, 03:31:08 AM
Thanks, but it's a bit harder for me, because I didn't work with masm before. I am a "rookie", but I want to learn.

the best thing you can do is to download the MASM32 package (download link in the upper right corner of the forum home page). It has a lot of examples and tutorials.

Gunther
You have to know the facts before you can distort them.

Gunther

A few other hints. There you'll find ADVANCED CONFIGURATION AND POWER INTERFACE SPECIFICATION (ACPI) specification. It has over 900 pages and is a playground for the "overclocker". The next article describes the access of the driver ACPI.sys. Good luck.

Gunther 
You have to know the facts before you can distort them.

Adamanteus

 Using thermal monitor is privileged instruction, so fully relies on OS and returning to applications  with help of WMI, but seems that this not fully supported on client OSes, so best way is simple not to overload CPU usage, as I already recommended in BitBlt And CPU 100% thread.

Rusica

Thank you! I'll do that.
For the moment, can anyone help me with my homework, because ai did all I can do for now, and I need to do it imediately? :D

gelatine1

This is not a homework site unfortunately maybe google can offer you the help you need.

dedndave

it's a tough assignment
some CPU's don't support tempurature
also - if you are running XP or earlier, you can use a driver
Vista and later have WHQL issues

Rusica

 CPU percentage is more easier to display in that window?

KeepingRealBusy

Rusica,

If you are running Windows, and all you want is CPU percentage, then use the Task Manager, Performance Tab.  But, that does not fulfill the homework task.

Dave.

GoneFishing

Getting LoadPercentage from WMI is really simple and straitforward ( unlike CPU temperature ,read the last post in this thread if you want to know why)
Quote
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    include \masm32\include\masm32rt.inc
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

comment * -----------------------------------------------------
                        Build this  template with
                       "CONSOLE ASSEMBLE AND LINK"
        ----------------------------------------------------- *

   
    .code

start:
   
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    call main
 
    exit

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

main proc

    invoke WinExec,chr$("wmic cpu get LoadPercentage /format:list /every:1 "),0 ; updates every second
 
    ret

main endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

end start
Press CTRL-C (or any key when prompted) to terminate it

Gunther

Hi Rusica,

Quote from: Rusica on April 30, 2014, 04:33:01 AM
For the moment, can anyone help me with my homework, because ai did all I can do for now, and I need to do it imediately? :D

it's very simple: we've a NO HOMEWORK Rule, which you can find here (rule #9). But we can help finding errors and weaknesses in code which you provide.

Gunther
You have to know the facts before you can distort them.

dedndave

we don't mind helping
but, we won't do all the work for you
a common misconception is that an urgency on your part creates an emergency on ours   :lol:
not our fault if you wait til it's due to ask for help

Magnum

Super Dave,

I feel that displaying the CPU temp is a harder project than writing an O.S. :-)

It is not a homework assignment unless the Professor is cruel. :-)

No offense intended to Gunther. :-)

Andy
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org