Subversion Repositories svnkaklik

Rev

Blame | Last modification | View Log | Download

unit Unit1;

interface

uses
  PORTINC,Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Timer1: TTimer;
    Edit1: TEdit;
    Edit2: TEdit;
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

 var
  Form1: TForm1;

implementation

{$R *.DFM}
function citac (Kanal : Integer) : Word;
var hodnota_portu : Byte;
begin
  if Kanal=1 then hodnota_portu := 1;      { A0 }
  if Kanal=2 then hodnota_portu := 2;      { A1 }

  RealTime (true);
  TimeInitus;
  OutPort($201,0);                     { Timer-Reset }
  While((InPort ($201) and hodnota_portu) = hodnota_portu)
    and (TimeReadus < 10000)do;
  citac:=TimeReadus;
  RealTime (false);
end;

procedure TForm1.Timer1Timer(Sender: TObject);
const
  stupen = 1.75;
var
  teplota :real;

begin
   Edit1.Text := FloatToStr(citac(1)) + ' %';
   teplota:=86;
   teplota:=teplota-citac(2);
   teplota:=teplota / stupen ;
   Edit2.Text := FloatToStr(teplota) + ' °C';

end;

end.