unit MainUnit; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls; type TForm1 = class(TForm) MainLabel: TLabel; PollTime: TTimer; procedure PollTimeTimer(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} uses AIOUSB; function IntToBin(I, MinBits: LongWord): String; var DoneBits: LongWord; begin Result := ''; DoneBits := 0; repeat Result := Char(Byte('0') + (I and 1)) + Result; I := I shr 1; Inc(DoneBits); until (I = 0) and (DoneBits >= MinBits); end; procedure TForm1.PollTimeTimer(Sender: TObject); var Status: LongWord; DIOData: Word; begin Status := DIO_ReadAll(diOnly, @DIOData); if Status <> ERROR_SUCCESS then MainLabel.Caption := 'Error ' + IntToStr(Status) + ' from DIO_ReadAll.' else MainLabel.Caption := IntToBin(DIOData, 16); ; end; end.