unit SimplePort2u1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, SmallPort, StdCtrls, Spin, ExtCtrls; type TForm1 = class(TForm) Button2: TButton; Button3: TButton; SmallPort1: TSmallPort; Label1: TLabel; Button1: TButton; SpinEdit1: TSpinEdit; Button4: TButton; Label2: TLabel; procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure Button1Click(Sender: TObject); procedure Button4Click(Sender: TObject); private { Private-Deklarationen } public { Public-Deklarationen } end; var Form1: TForm1; implementation {$R *.DFM} // use "smport.vxd" driver with Win95/98, // copy file to "Windows\System" directory or to directory of your application // use "smport.sys" driver with WIN NT/2000, // copy file to "WinNT\SYSTEM32" directory or to directory of your application procedure TForm1.Button2Click(Sender: TObject); begin SmallPort1.Port[$378]:=0; end; procedure TForm1.Button3Click(Sender: TObject); begin SmallPort1.Port[$378]:=$ff; end; procedure TForm1.FormCreate(Sender: TObject); begin SmallPort1.Opened:=true; end; procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin SmallPort1.Opened:=false; end; procedure TForm1.Button1Click(Sender: TObject); begin SmallPort1.Port[$378]:=SpinEdit1.Value; end; procedure TForm1.Button4Click(Sender: TObject); var Data: Byte; S : String; begin Data := SmallPort1.Port[$378]; Str(Data, S); Label2.Caption:=S; end; end.