Znalazłem w sieci taki kod:
unit Cputemp1;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Timer1: TTimer;
Label2: TLabel;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
cnt: integer;
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
Label1.caption := 'T(MB)'+' °C';
Label2.caption := 'T(CPU)'+' °C';
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
i: integer ;
mtm: integer;
ts: integer;
tm: integer;
ct: integer;
temp: real;
cond: boolean;
s: string;
s1: string;
begin
Timer1.Interval := 3000;
{Read temperature}
Port[$295] := $27;
i := port [$296];
str(i:2,s);
Label1.caption := 'T(MB) = '+s+' °C';
{ read cpu temp}
mtm :=10;
ts:=port[$e800] ;
tm:=0;
while (((ts and 1) = 1)and (tm < mtm)) do
begin
ts:=port[$e800];
tm := tm+1;
end;
if (tm >= mtm) then Label2.caption := 'lm78 timeout1';
tm:=0;
if (((ts and $1e) <> 0)and (tm < mtm)) then
begin
port[$e800]:=ts;
tm:=tm+1;
end;
if (tm >= mtm) then Label2.caption := 'lm78 timeout2';
port[$e803]:=0;
port[$e804]:=$93;
ct:=port[$e802];
ct:=(ct and $e0)or $c;
port[$e802]:=ct;
port[$e802]:=ct or $40;
tm:=0;
while (((port[$e800] and 1)= 1) and ( tm < mtm)) do tm:=tm+1;
if (tm >= mtm) then Label2.caption := 'lm78 timeout3' ;
temp:= port[$e805] ;
ts := port[$e806] ;
ts:= ts shr 7;
ts := ts and 1;
temp := temp +8;
if (ts = 1) then temp:= temp + 0.5;
str(temp:4:1,s1);
Label2.caption := 'T(CPU) = '+s1+' °C';
end;
end.
Wszystko działa, oprócz tego, że w moim Turbo Delphi nie działa polecenie port :-[
Co zrobić, aby sprawdzić temperaturę procesora w Turbo Delphi i jak sprawdzić prędkość wentylatorka?