program sample0; uses crt,cppdelay; function AskForBaseAddress(Oldone : String) : Word; const Msg : string[4] = '0'; var NewOne, Success, Dummy, Error : Word; AddrInputPosX, AddrInputPosY : Word; begin WriteLn('Please Enter the Base Address (0000-FFFF) for your card (in hex)'); WriteLn('or press ENTER for ', OldOne, '. '); Write('>'); AddrInputPosX := WhereX; AddrInputPosY := WhereY; repeat GotoXY(AddrInputPosX, AddrInputPosY); ClrEol; Readln(Msg); Val('$' + Msg, NewOne, Error); if (error=0) then begin Success := 1; Dummy := NewOne; end else if (Msg = '') then begin GotoXY(AddrInputPosX, AddrInputPosY); WriteLn(OldOne); Msg := OldOne; Success := 1; Val('$' + Msg, Dummy, Error); end; until (Success = 1); AskForBaseAddress := Dummy; end; {End of AskForBaseAddress} var Base:word; data,chan:Integer; timeout,test:word; begin ClrScr; writeln('Sample 0'); writeln('This program will read data from all channels on the A/D card.'); Base:=AskForBaseAddress('300'); gotoxy(1,19); writeln('Press any key to exit.'); while ( not keypressed) do begin cdelay(250); gotoxy(1,10); for chan := 0 to 7 do begin timeout:=65535; port[Base+2] := chan; while (((port[Base+0] and $80)<>0) and (timeout < 0)) do timeout:=timeout-1; if timeout=0 then writeln('A/D Timeout') else ClrEol; data:=portw[Base+2]; writeln('Chan ', chan, ' Data Read: ',data); end; end; gotoxy(1,20); end.