Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
unit Unit1;
2
 
3
interface
4
 
5
uses
6
  PORTINC,Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7
  Dialogs, StdCtrls, ExtCtrls;
8
 
9
type
10
  TForm1 = class(TForm)
11
    Label1: TLabel;
12
    Label2: TLabel;
13
    Timer1: TTimer;
14
    Edit1: TEdit;
15
    Edit2: TEdit;
16
    procedure Timer1Timer(Sender: TObject);
17
  private
18
    { Private declarations }
19
  public
20
    { Public declarations }
21
  end;
22
 
23
 var
24
  Form1: TForm1;
25
 
26
implementation
27
 
28
{$R *.DFM}
29
function citac (Kanal : Integer) : Word;
30
var hodnota_portu : Byte;
31
begin
32
  if Kanal=1 then hodnota_portu := 1;      { A0 }
33
  if Kanal=2 then hodnota_portu := 2;      { A1 }
34
 
35
  RealTime (true);
36
  TimeInitus;
37
  OutPort($201,0);                     { Timer-Reset }
38
  While((InPort ($201) and hodnota_portu) = hodnota_portu)
39
    and (TimeReadus < 10000)do;
40
  citac:=TimeReadus;
41
  RealTime (false);
42
end;
43
 
44
procedure TForm1.Timer1Timer(Sender: TObject);
45
const
46
  stupen = 1.75;
47
var
48
  teplota :real;
49
 
50
begin
51
   Edit1.Text := FloatToStr(citac(1)) + ' %';
52
   teplota:=86;
53
   teplota:=teplota-citac(2);
54
   teplota:=teplota / stupen ;
55
   Edit2.Text := FloatToStr(teplota) + ' °C';
56
 
57
end;
58
 
59
end.