Blame | Last modification | View Log | Download
unit Unit1;interfaceusesPORTINC,Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls, ExtCtrls;typeTForm1 = class(TForm)Label1: TLabel;Label2: TLabel;Timer1: TTimer;Edit1: TEdit;Edit2: TEdit;procedure Timer1Timer(Sender: TObject);private{ Private declarations }public{ Public declarations }end;varForm1: TForm1;implementation{$R *.DFM}function citac (Kanal : Integer) : Word;var hodnota_portu : Byte;beginif 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);conststupen = 1.75;varteplota :real;beginEdit1.Text := FloatToStr(citac(1)) + ' %';teplota:=98;teplota:=teplota-citac(2);teplota:=teplota / stupen ;Edit2.Text := FloatToStr(citac(2)) + ' °C';end;end.