unit sample0u; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, ComCtrls, StdCtrls; type TSample0Form = class(TForm) Memo1: TMemo; ExitButton: TButton; ISAPanel: TGroupBox; HexLabel: TLabel; BaseEdit: TEdit; TestButton: TButton; TestTimer: TTimer; ChannelBox: TGroupBox; ChannelLabel1: TLabel; ChannelLabel2: TLabel; ChannelLabel3: TLabel; ChannelLabel4: TLabel; ChannelLabel5: TLabel; ChannelLabel6: TLabel; ChannelLabel7: TLabel; ChannelLabel8: TLabel; TitleLabel: TLabel; CardName: TLabel; ErrorStatus: TStatusBar; procedure ExitButtonClick(Sender: TObject); procedure TestTimerTimer(Sender: TObject); procedure TestButtonClick(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Sample0Form: TSample0Form; AbortCheck : Bool; implementation uses ACCES32; {$R *.DFM} procedure TSample0Form.ExitButtonClick(Sender: TObject); begin Close; end; { end ExitButtonCLick } procedure TSample0Form.TestTimerTimer(Sender: TObject); var base : Word; channel, timeout : integer; data : Double; begin base := StrToInt('$'+BaseEdit.Text); for channel:=0 to 7 do begin timeout := 1000; OutPortB(base+2, channel); Sleep(2); OutPortB(base+3, 0); while (NOT((InPortB(base+2) AND $80) = 0) AND (timeout > 0)) do dec(timeout); if timeout <= 0 then ErrorStatus.SimpleText := Format('A/D timeout on Channel %1x',[channel]); data:=(InPort(base+6) shr 4) and $0FFF; (ChannelBox.Controls[channel] as TLabel).Caption := Format(' Channel %1x %12g',[channel,data]); end; { end for } end; { end TestTimerTimer } procedure TSample0Form.TestButtonClick(Sender: TObject); var x : integer; begin AbortCheck := False; if TestTimer.Enabled = True then begin TestTimer.Enabled := False; AbortCheck := True; for x := 0 to 7 do (ChannelBox.Controls[x] as TLabel).Caption := Format(' Channel %1x 0',[x]); ErrorStatus.SimpleText := ''; TestButton.Caption := 'Start Test'; end else begin TestTimer.Enabled := True; AbortCheck := False; TestButton.Caption := 'Abort Test'; end end; { end TestButtonClick } procedure TSample0Form.FormCreate(Sender: TObject); begin if (InPortB($61) = $AA55) then begin Application.MessageBox('ACCESNT.SYS not detected. Please copy ACCESNT.SYS into [NT]/system32/drivers and re-run this sample.', 'Warning', IDOK); end; end; end.