Odczyt temperatury poraz N^n :]

0

Ludzie...Wie ktoś może już jak odczytać temperaturę procka ??
Napisałem na jakimś forum angielskim prośbę o pomoc, i przysłali mi cos takiego:
You might access the shared memory from SpeedFan or from other softwares like
it.
Or you might try to access WMI data.
Tylko jak uzyskać dostęp do tych danych ??
Na jakimś innym forum, znalazłem nawet kod. Tylko coś w nim nie działa :(
Oto 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. 

Delphi nie rozumie co to jest: Port, użyty np. w
port[$e803]:=0; [glowa] [???]

0

Sorka ale nic z tego nie rozumiem :-/ A nie da się z tym kodem coś zrobić, żeby działał ??

0

http://4programmers.net/Forum/viewtopic.html?id=46361

zamień:

port[numerportu]:=wartość na outportb(numerportu,wartosc)
wartosc:=port[numerportu] na wartosc:=inportb(numerportu)

Outportb zapisuje bajt do portu, a inportb odczytuje z niego wartość.
A poza tym sprawdź, czy ten przykład jest dla twojej płyty głównej, bo tylko od niej zależy, czy zadziała. I jeszcze jedno. Ten kod jest dla borland pascala for łindołs, może nawet freepascala, więc nie dziw się, że delphi nie rozumie takich rzeczy jak port/portw.

1 użytkowników online, w tym zalogowanych: 0, gości: 1