Parceiros Wgets downloads
Unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ALed, IOport; type TForm1 = class(TForm) encoder: TMemo; Memo1: TMemo; Edit1: TEdit; Label1: TLabel; Memo2: TMemo; Memo3: TMemo; Label2: TLabel; Memo4: TMemo; Button1: TButton; TimerLeitura: TTimer; IO378: TIOport; D0: ThhALed; Label3: TLabel; D1: ThhALed; Label4: TLabel; D2: ThhALed; Label5: TLabel; D3: ThhALed; Label6: TLabel; D4: ThhALed; Label7: TLabel; D5: ThhALed; Label8: TLabel; procedure Button1Click(Sender: TObject); procedure TimerLeituraTimer(Sender: TObject); private { Private declarations } public function Bool(valor : integer) : boolean; end; var Form1: TForm1; implementation {$R *.D function TForm1.Bool(valor: integer): boolean; begin if valor = 1 then Bool := true else Bool := false; end; procedure TForm1.Button1Click(Sender: TObject); var i,j : integer; val : integer; begin memo2.clear; for j :=0 to memo3.lines.count -1 do begin val := strtoint(memo4.lines[j]); for i:=0 to encoder.lines.count-1 do begin memo2.lines.add(floattostr(strtofloat(memo1.lines[i])*strtofloat(edit1.text)+val)); end; end; end; procedure TForm1.TimerLeituraTimer(Sender: TObject); begin D0.Value := Bool(IO378.getbit(0)); D1.Value := Bool(IO378.getbit(1)); D2.Value := Bool(IO378.getbit(2)); D3.Value := Bool(IO378.getbit(3)); D4.Value := Bool(IO378.getbit(4)); D5.Value := Bool(IO378.getbit(5)); end; end.