unit LED;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, ComCtrls;
type
TForm1 =
class(TForm)
Panel1: TPanel;
GroupBox1: TGroupBox;
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
Shape4: TShape;
Shape5: TShape;
Shape8: TShape;
Shape6: TShape;
Shape7: TShape;
Timer1: TTimer;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
Button1: TButton;
RichEdit1: TRichEdit;
Label1: TLabel;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
CheckBox4: TCheckBox;
CheckBox5: TCheckBox;
CheckBox6: TCheckBox;
CheckBox7: TCheckBox;
procedure RadioButton1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure RadioButton8Click(Sender: TObject);
procedure RadioButton7Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure Shape1ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
procedure Shape2ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
procedure Shape3ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
procedure Shape4ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
procedure Shape5ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
procedure Shape7ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
procedure Shape8ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
procedure CheckBox7Click(Sender: TObject);
procedure CheckBox6Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Shape6ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
LED_WERT : Integer;
implementation
{$R *.dfm}
procedure Out32(Addresse:Integer; Wert:byte);
stdcall;
export;
external '
INPOUT32.DLL';
function Inp32(Addresse:Integer):Byte;
stdcall;
export;
external '
INPOUT32.DLL';
const
Port = $378;
procedure TForm1.RadioButton1Click(Sender: TObject);
begin
Timer1.Enabled := True;
end;
procedure LED_OUT(LED_wert : Integer);
begin
out32(port, LED_WERT);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Close;
end;
procedure TForm1.RadioButton8Click(Sender: TObject);
begin
LED_WERT := LED_wert+255;
LED_OUT(LED_WERT);
shape1.Brush.Color := clyellow;
shape2.Brush.Color := clyellow;
shape3.Brush.Color := clyellow;
shape4.Brush.Color := clyellow;
shape5.Brush.Color := clyellow;
shape6.Brush.Color := clyellow;
shape7.Brush.Color := clyellow;
shape8.Brush.Color := clyellow;
end;
procedure TForm1.RadioButton7Click(Sender: TObject);
begin
LED_WERT := 0;
LED_OUT(LED_WERT);
shape1.Brush.Color := clred;
shape2.Brush.Color := clred;
shape3.Brush.Color := clred;
shape4.Brush.Color := clred;
shape5.Brush.Color := clred;
shape6.Brush.Color := clred;
shape7.Brush.Color := clred;
shape8.Brush.Color := clred;
end;
procedure TForm1.RadioButton2Click(Sender: TObject);
begin
Timer1.Enabled := True;
end;
procedure TForm1.Shape1ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
if shape1.Brush.Color = clYellow
then
begin
shape1.Brush.Color := clRed;
LED_OUT(0);
end else
begin
shape1.Brush.Color := clYellow;
LED_OUT(1);
end;
end;
procedure TForm1.Shape2ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
if shape2.Brush.Color = clYellow
then
begin
shape2.Brush.Color := clRed;
LED_OUT(0);
end else
begin
shape2.Brush.Color := clYellow;
LED_OUT(2);
end;
end;
procedure TForm1.Shape3ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
if shape3.Brush.Color = clYellow
then
begin
shape3.Brush.Color := clRed;
LED_OUT(0);
end else
begin
shape3.Brush.Color := clYellow;
LED_OUT(4);
end;
end;
procedure TForm1.Shape4ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
if shape4.Brush.Color = clYellow
then
begin
shape4.Brush.Color := clRed;
LED_OUT(0);
end else
begin
shape4.Brush.Color := clYellow;
LED_OUT(8);
end;
end;
procedure TForm1.Shape5ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
if shape5.Brush.Color = clYellow
then
begin
shape5.Brush.Color := clRed;
LED_OUT(0);
end else
begin
shape5.Brush.Color := clYellow;
LED_OUT(16);
end;
end;
procedure TForm1.Shape7ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
if shape7.Brush.Color = clYellow
then
begin
shape7.Brush.Color := clRed;
LED_OUT(0);
end else
begin
shape7.Brush.Color := clYellow;
LED_OUT(64);
end;
end;
procedure TForm1.Shape8ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
if shape8.Brush.Color = clYellow
then
begin
shape8.Brush.Color := clRed;
LED_OUT(0);
end else
begin
shape8.Brush.Color := clYellow;
LED_OUT(128);
end;
end;
procedure TForm1.CheckBox7Click(Sender: TObject);
begin
LED_OUT(255);
if Checkbox7.Checked = false
then
LED_OUT(0);
end;
procedure TForm1.CheckBox6Click(Sender: TObject);
var
i, j : Integer;
begin
Timer1.Enabled := true;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var i,j : Integer;
begin
//if Checkbox6.Checked =true then
//begin
while Checkbox6.Checked = true
do
for i := 1
to 1000
do
LED_OUT(255);
for j := 1
to 1000
do
LED_OUT(0);
//end else
LED_OUT(0);
end;
procedure TForm1.Shape6ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
if shape6.Brush.Color = clYellow
then
begin
shape6.Brush.Color := clRed;
LED_OUT(0);
end else
begin
shape6.Brush.Color := clYellow;
LED_OUT(32);
end;
end;
end.