Sie sind auf Seite 1von 13

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, ExtCtrls, StdCtrls, Buttons;

type

TForm1 = class(TForm)

Label1: TLabel;

Shape1: TShape;

Shape2: TShape;

Shape3: TShape;

Shape4: TShape;

Button1: TButton;

Button2: TButton;

Button3: TButton;

Button4: TButton;

BitBtn1: TBitBtn;

procedure FormActivate(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;
var

Form1: TForm1;

implementation

procedure PortOut(Port : Word; Data : Byte); stdcall; external 'io.dll';

function PortIn(Port : Word) : Byte; stdcall; external 'io.dll';

{$R *.dfm}

var data, ST1, ST2, ST3, ST4 : byte;

procedure TForm1.FormActivate(Sender: TObject);

begin

shape1.Brush.Color := clbtnface;

shape2.Brush.Color := clbtnface;

shape3.Brush.Color := clbtnface;

shape4.Brush.Color := clbtnface;

data := 0;

portout($378,data);

ST1 := 0; ST2 := 0; ST3 := 0; ST4 := 0;

end;

procedure TForm1.Button1Click(Sender: TObject);

begin

If ST1=0 then

begin

data := data OR $08;

portout($378,data);

shape1.Brush.Color := clgreen;

ST1 := 1;

button1.Caption := 'L-01-off';
end

else

begin

data := data AND $F7;

portout($378,data);

shape1.Brush.Color := clbtnface;

ST1 := 0;

button1.Caption := 'L-01-on';

end

end;

procedure TForm1.Button2Click(Sender: TObject);

begin

If ST2=0 then

begin

data := data OR $04;

portout($378,data);

shape2.Brush.Color := clgreen;

ST2 := 1;

button2.Caption := 'L-02-off';

end

else

begin

data := data AND $FB;

portout($378,data);

shape2.Brush.Color := clbtnface;

ST2 := 0;

button2.Caption := 'L-02-on';

end

end;
procedure TForm1.Button3Click(Sender: TObject);

begin

If ST3=0 then

begin

data := data OR $02;

portout($378,data);

shape3.Brush.Color := clgreen;

ST3 := 1;

button3.Caption := 'L-03-off';

end

else

begin

data := data AND $FD;

portout($378,data);

shape3.Brush.Color := clbtnface;

ST3 := 0;

button3.Caption := 'L-03-on';

end

end;

procedure TForm1.Button4Click(Sender: TObject);

begin

If ST4=0 then

begin

data := data OR $01;

portout($378,data);

shape4.Brush.Color := clgreen;

ST4 := 1;

button4.Caption := 'L-04-off';

end

else
begin

data := data AND $FE;

portout($378,data);

shape4.Brush.Color := clbtnface;

ST4 := 0;

button4.Caption := 'L-04-on';

end

end;

end. unit Unit1;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, ExtCtrls, StdCtrls, Buttons;

type

TForm1 = class(TForm)

Label1: TLabel;

Shape1: TShape;

Shape2: TShape;

Shape3: TShape;

Shape4: TShape;

Button1: TButton;

Button2: TButton;

Button3: TButton;

Button4: TButton;

BitBtn1: TBitBtn;

procedure FormActivate(Sender: TObject);


procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

procedure PortOut(Port : Word; Data : Byte); stdcall; external 'io.dll';

function PortIn(Port : Word) : Byte; stdcall; external 'io.dll';

{$R *.dfm}

var data, ST1, ST2, ST3, ST4 : byte;

procedure TForm1.FormActivate(Sender: TObject);

begin

shape1.Brush.Color := clbtnface;

shape2.Brush.Color := clbtnface;

shape3.Brush.Color := clbtnface;

shape4.Brush.Color := clbtnface;

data := 0;

portout($378,data);

ST1 := 0; ST2 := 0; ST3 := 0; ST4 := 0;

end;
procedure TForm1.Button1Click(Sender: TObject);

begin

If ST1=0 then

begin

data := data OR $08;

portout($378,data);

shape1.Brush.Color := clgreen;

ST1 := 1;

button1.Caption := 'L-01-off';

end

else

begin

data := data AND $F7;

portout($378,data);

shape1.Brush.Color := clbtnface;

ST1 := 0;

button1.Caption := 'L-01-on';

end

end;

procedure TForm1.Button2Click(Sender: TObject);

begin

If ST2=0 then

begin

data := data OR $04;

portout($378,data);

shape2.Brush.Color := clgreen;

ST2 := 1;

button2.Caption := 'L-02-off';

end
else

begin

data := data AND $FB;

portout($378,data);

shape2.Brush.Color := clbtnface;

ST2 := 0;

button2.Caption := 'L-02-on';

end

end;

procedure TForm1.Button3Click(Sender: TObject);

begin

If ST3=0 then

begin

data := data OR $02;

portout($378,data);

shape3.Brush.Color := clgreen;

ST3 := 1;

button3.Caption := 'L-03-off';

end

else

begin

data := data AND $FD;

portout($378,data);

shape3.Brush.Color := clbtnface;

ST3 := 0;

button3.Caption := 'L-03-on';

end

end;

procedure TForm1.Button4Click(Sender: TObject);


begin

If ST4=0 then

begin

data := data OR $01;

portout($378,data);

shape4.Brush.Color := clgreen;

ST4 := 1;

button4.Caption := 'L-04-off';

end

else

begin

data := data AND $FE;

portout($378,data);

shape4.Brush.Color := clbtnface;

ST4 := 0;

button4.Caption := 'L-04-on';

end

end;

end. unit Unit1;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, ExtCtrls, StdCtrls, Buttons;

type

TForm1 = class(TForm)

Label1: TLabel;
Shape1: TShape;

Shape2: TShape;

Shape3: TShape;

Shape4: TShape;

Button1: TButton;

Button2: TButton;

Button3: TButton;

Button4: TButton;

BitBtn1: TBitBtn;

procedure FormActivate(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

procedure PortOut(Port : Word; Data : Byte); stdcall; external 'io.dll';

function PortIn(Port : Word) : Byte; stdcall; external 'io.dll';

{$R *.dfm}

var data, ST1, ST2, ST3, ST4 : byte;


procedure TForm1.FormActivate(Sender: TObject);

begin

shape1.Brush.Color := clbtnface;

shape2.Brush.Color := clbtnface;

shape3.Brush.Color := clbtnface;

shape4.Brush.Color := clbtnface;

data := 0;

portout($378,data);

ST1 := 0; ST2 := 0; ST3 := 0; ST4 := 0;

end;

procedure TForm1.Button1Click(Sender: TObject);

begin

If ST1=0 then

begin

data := data OR $08;

portout($378,data);

shape1.Brush.Color := clgreen;

ST1 := 1;

button1.Caption := 'L-01-off';

end

else

begin

data := data AND $F7;

portout($378,data);

shape1.Brush.Color := clbtnface;

ST1 := 0;

button1.Caption := 'L-01-on';

end

end;
procedure TForm1.Button2Click(Sender: TObject);

begin

If ST2=0 then

begin

data := data OR $04;

portout($378,data);

shape2.Brush.Color := clgreen;

ST2 := 1;

button2.Caption := 'L-02-off';

end

else

begin

data := data AND $FB;

portout($378,data);

shape2.Brush.Color := clbtnface;

ST2 := 0;

button2.Caption := 'L-02-on';

end

end;

procedure TForm1.Button3Click(Sender: TObject);

begin

If ST3=0 then

begin

data := data OR $02;

portout($378,data);

shape3.Brush.Color := clgreen;

ST3 := 1;

button3.Caption := 'L-03-off';

end

else
begin

data := data AND $FD;

portout($378,data);

shape3.Brush.Color := clbtnface;

ST3 := 0;

button3.Caption := 'L-03-on';

end

end;

procedure TForm1.Button4Click(Sender: TObject);

begin

If ST4=0 then

begin

data := data OR $01;

portout($378,data);

shape4.Brush.Color := clgreen;

ST4 := 1;

button4.Caption := 'L-04-off';

end

else

begin

data := data AND $FE;

portout($378,data);

shape4.Brush.Color := clbtnface;

ST4 := 0;

button4.Caption := 'L-04-on';

end

end;

end.