如何获取CPU温度以及风扇转速?(300分)

红外线测速器,手动测量可以做到。
编程方法,哈哈,我 也想知道,如果你能够得到BIOS 的信息,你就可以。
 
传说CPU的一个引脚专门传输CPU温度、风扇转速等数据。但如何得到此引脚数据的内存地址呢?即使得到了地址,这个地址一定是操作系统保护起来的。不知道BIOS的那块内存是否也被操作系统保护了。
 
顶你吧...我爱莫能助,硬件不是太熟.
 
yu_ting, 不一定保护起来的, 很可能只是映射到每个进程的特定线性地址的。
我虽然不知原理, 不过如果是我的话一定DASM看看^_^
 
我以前写过获取CPU风扇转速和温度的代码,不过现在找不到了,找到了给你。其实很简单的,确实是读取BIOS信息。
还有,benhacker,你是哪里人啊?
 
dywapple,不甚感激!若能解决此问题,定1000分送上,决不食言!
 
好的,你可能要等几天。
 
用GiveIO,SpeedFan就是使用GiveIO的。然后参见主板BIOS厂商提供的pdf文档得到相关CMOS数据在内存中的地址,通过GiveIO直接使用In、Out对I/O端口操作。
相关的C++.Net代码如下:
void CVCGiveIoTestDlg::OnTimer(UINT nIDEvent)
{
int nRead;
TCHAR strTemp[256];
int nPortIndex=0x295;
int nPortData=0x296;
int nSerial_Bus_Address_Register=0x48;
int nTemperature_reading=0x27;
int nFAN1_reading=0x28;
int nFAN2_reading=0x29;
int nFAN3_reading=0x2a;
int nBank_Select_Register=0x4e;
int nBank_Select_Bank1=0x81;
int nBank_Select_Bank2=0x82;
int nTemperature_Sensor_Up8=0x50;//只读要高位8个字节,最低1个字节不要了

//测试是否发生冲突
nRead=_inp((short)nPortIndex);
if((nRead&0x80)==0x80)
{
GetDlgItem(IDC_SENSOR_TEMP1)->SetWindowText("发生冲突");
GetDlgItem(IDC_SENSOR_FAN3)->SetWindowText("发生冲突");
return;
}
//读取系统温度
_outp((short)nPortIndex,nSerial_Bus_Address_Register);
_outp((short)nPortData,nTemperature_reading);
_outp((short)nPortIndex,nTemperature_reading);
nRead=_inp((short)nPortData);
sprintf(strTemp,"%d 度",nRead);
GetDlgItem(IDC_SENSOR_TEMP1)->SetWindowText(strTemp);
//读CPU温度
_outp((short)nPortIndex,nBank_Select_Register);
_outp((short)nPortData,nBank_Select_Bank1);
_outp((short)nPortIndex,nTemperature_Sensor_Up8);
nRead=_inp((short)nPortData);
sprintf(strTemp,"%d 度",nRead);
GetDlgItem(IDC_SENSOR_TEMP2)->SetWindowText(strTemp);
_outp((short)nPortIndex,nBank_Select_Register);
_outp((short)nPortData,nBank_Select_Bank2);
_outp((short)nPortIndex,nTemperature_Sensor_Up8);
nRead=_inp((short)nPortData);
sprintf(strTemp,"%d 度",nRead);
GetDlgItem(IDC_SENSOR_TEMP3)->SetWindowText(strTemp);
//读CPU风扇转速度
for(int nInx=0;nInx<3;nInx++)
{
_outp((short)nPortIndex,nSerial_Bus_Address_Register);
_outp((short)nPortData,nFAN1_reading+nInx);
_outp((short)nPortIndex,nFAN1_reading+nInx);
nRead=_inp((short)nPortData);
if(nRead==0xff) continue;
nRead=1350000/(nRead*4);
sprintf(strTemp,"%d 转",nRead);
GetDlgItem(IDC_SENSOR_FAN1+nInx)->SetWindowText(strTemp);
}
CDialog::OnTimer(nIDEvent);
}
其它东东等着你自己去发现了。
 
需要什么权限来执行这个
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
970
swish
S
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
I
回复
0
查看
703
import
I
顶部