Source file: /~heha/messtech/ddegpib.zip/SRC/TPWGPIB.PAS

(****************** Turbo Pascal for Windows Declarations ******************)
unit tpwgpib;
{Letzte Modifikation H. Haftmann 08.12.97 (Interface-Teil ist kompatibel)}

interface

uses
  WinTypes;

(***************************************************************************)
(*  Define various constant values                                         *)

Const

(* GPIB Commands:                                                           *)

   UNL  =  $3f;                       (* GPIB unlisten command              *)
   UNT  =  $5f;                       (* GPIB untalk command                *)
   GTL  =  $01;                       (* GPIB go to local                   *)
   SDC  =  $04;                       (* GPIB selected device clear         *)
   PPC  =  $05;                       (* GPIB parallel poll configure       *)
   GET =   $08;                       (* GPIB group execute trigger         *)
   TCT  =  $09;                       (* GPIB take control                  *)
   LLO  =  $11;                       (* GPIB local lock out                *)
   DCL  =  $14;                       (* GPIB device clear                  *)
   PPU  =  $15;                       (* GPIB parallel poll unconfigure     *)
   SPE  =  $18;                       (* GPIB serial poll enable            *)
   SPD  =  $19;   	              (* GPIB serial poll disable           *)
   PPE  =  $60;   		      (* GPIB parallel poll enable          *)
   PPD  =  $70;   		      (* GPIB parallel poll disable         *)

(* GPIB status bit vector:                                                  *)

   ERR   = -$8000;			(* Error detected                   *)
   TIMO  = $4000;			(* Timeout                          *)
   EEND  = $2000;			(* EOI or EOS detected              *)
   SRQI  = $1000;			(* SRQ detected by CIC              *)
   RQS   = $800; 			(* Device needs service             *)
   SPOLL = $400;                        (* Board has been serially polled   *)
   EVENT = $200;                        (* An event has occured             *)
   CMPL  = $100; 			(* I/O completed                    *)
   LOK   = $80;  			(* Local lockout state              *)
   REM   = $40;  			(* Remote state                     *)
   CIC   = $20;  			(* Controller-in-Charge             *)
   ATN   = $10;  			(* Attention asserted               *)
   TACS  = $8;   			(* Talker active                    *)
   LACS  = $4;   			(* Listener active                  *)
   DTAS  = $2;   			(* Device trigger state             *)
   DCAS  = $1;   			(* Device clear state               *)

(* Error messages returned in global variable IBERR:                        *)

   EDVR  = 0;                   (* system error                             *)
   ECIC  = 1; 		   	(* Function requires GPIB board to be CIC   *)
   ENOL  = 2; 		   	(* Write function detected no Listeners     *)
   EADR  = 3; 		        (* Interface board not addressed correctly  *)
   EARG  = 4; 		        (* Invalid argument to function call        *)
   ESAC  = 5; 		   	(* Function requires GPIB board to be SAC   *)
   EABO  = 6; 		   	(* I/O operation aborted                    *)
   ENEB  = 7; 		   	(* Non-existent interface board             *)
   EDMA  = 8;
   EOIP  = 10;		   	(* I/O operation started before previous    *)
		 		(* operation completed                      *)
   ECAP  = 11;		   	(* No capability for intended operation     *)
   EFSO  = 12;		   	(* File system operation error              *)
   EBUS  = 14;		   	(* Command error during device call         *)
   ESTB  = 15;		   	(* Serial poll status byte lost             *)
   ESRQ  = 16;  	        (* SRQ remains asserted                     *)
   ETAB  = 20;                  (* The return buffer is full                *)
   ELCK  = 21;

(* EOS mode bits:                                                           *)

   BIN  = $1000;			(* Eight bit compare                *)
   XEOS = $800; 			(* Send EOI with EOS byte           *)
   REOS = $400; 			(* Terminate read on EOS            *)


(* Timeout values and meanings:                                             *)

   TNONE    = 0;  			(* Infinite timeout  (disabled)     *)
   T10us    = 1;  			(* Timeout of 10 us  (ideal)        *)
   T30us    = 2;  			(* Timeout of 30 us  (ideal)        *)
   T100us   = 3;  			(* Timeout of 100 us (ideal)        *)
   T300us   = 4;  			(* Timeout of 300 us (ideal)        *)
   T1ms     = 5;  			(* Timeout of 1 ms   (ideal)        *)
   T3ms     = 6;  			(* Timeout of 3 ms   (ideal)        *)
   T10ms    = 7;  			(* Timeout of 10 ms  (ideal)        *)
   T30ms    = 8;  			(* Timeout of 30 ms  (ideal)        *)
   T100ms   = 9;  			(* Timeout of 100 ms (ideal)        *)
   T300ms   = 10; 			(* Timeout of 300 ms (ideal)        *)
   T1s      = 11; 			(* Timeout of 1 s    (ideal)        *)
   T3s      = 12; 			(* Timeout of 3 s    (ideal)        *)
   T10s     = 13; 			(* Timeout of 10 s   (ideal)        *)
   T30s     = 14; 			(* Timeout of 30 s   (ideal)        *)
   T100s    = 15; 			(* Timeout of 100 s  (ideal)        *)
   T300s    = 16; 			(* Timeout of 300 s  (ideal)        *)
   T1000s   = 17; 			(* Timeout of 1000 s (maximum)      *)

(* Miscellaneous:                                                           *)

   S  = $08;              	    (* Parallel poll sense bit              *)
   LF = $0A;   		            (* ASCII linefeed character             *)

   NO_SAD  = 0;                     (* test only the pad                    *)
   ALL_SAD = -1;                    (* test all secondary addresses of pad  *)

(*  IBEVENT Constants                                                       *)

   EventDTAS =  1;
   EventDCAS =  2;

(* Values for the 488.2 Send command                                        *)

   NULLend = 00;                (* do nothing at the end of a transfer      *)
   NLend   = 01;                (* send NL with EOI after a transfer        *)
   DABend  = 02;                (* send EOI with the last DAB               *)

(* This value is used by the 488.2 Receive command.                         *)

   STOPend = $0100;              (* stop the read on EOI                    *)


(* This value is used to terminate a 488.2 address list.  It should be      *)
(* assigned to the pad field of the last entry.                             *)
   
   NOADDR = -1;

(* The following constants are used for the second parameter of the         *)
(* ibconfig function.  They are the "option" selection codes.               *)

   IbcPAD=          $0001;  (* Primary Address                              *)
   IbcSAD=          $0002;  (* Secondary Address                            *)
   IbcTMO=          $0003;  (* Timeout Value                                *)
   IbcEOT=          $0004;  (* Send EOI with last data byte?                *)
   IbcPPC=          $0005;  (* Parallel Poll Configure                      *)
   IbcREADDR=       $0006;  (* Repeat Addressing                            *)
   IbcAUTOPOLL=     $0007;  (* Disable Auto Serial Polling                  *)
   IbcCICPROT=      $0008;  (* Use the CIC Protocol?                        *)
   IbcIRQ=          $0009;  (* Use PIO for I/O                              *)
   IbcSC=           $000A;  (* Board is System Controller.                  *)
   IbcSRE=          $000B;  (* Assert SRE on device calls?                  *)
   IbcEOSrd=        $000C;  (* Terminate reads on EOS.                      *)
   IbcEOSwrt=       $000D;  (* Send EOI with EOS character.                 *)
   IbcEOScmp=       $000E;  (* Use 7 or 8-bit EOS compare.                  *)
   IbcEOSchar=      $000F;  (* The EOS character.                           *)
   IbcPP2=          $0010;  (* Use Parallel Poll Mode 2.                    *)
   IbcTIMING=       $0011;  (* NORMAL, HIGH, or VERY_HIGH timing.           *)
   IbcDMA=          $0012;  (* Use DMA for I/O.                             *)
   IbcReadAdjust=   $0013;  (* Swap bytes during an ibrd.                   *)
   IbcWriteAdjust=  $0014;  (* Swap bytes during an ibwrt.                  *)
   IbcEventQueue=   $0015;  (* Enable/disable the event queue.              *)
   IbcSPollBit=     $0016;  (* Enable/disable the visibility of SPOLL.      *)
   IbcSendLLO=      $0017;  (* Enable/disable the sending of LLO.           *)
   IbcSPollTime=    $0018;  (* Set the timeout value for serial polls.      *)
   IbcPPollTime=    $0019;  (* Set the parallel poll length period.         *)
   IbcNoEndBitOnEOS= $001A; (* Remove EOS from END bit of IBSTA.            *)
   IbcUnAddr=        $001B; (* Enable/disable device unaddressing.          *)

(*    Constants that can be used (in addition to the ibconfig constants)    *)
(*    when calling the ibask() function.                                    *)

   IbaPAD=          $0001;  (* Primary Address                              *)
   IbaSAD=          $0002;  (* Secondary Address                            *)
   IbaTMO=          $0003;  (* Timeout Value                                *)
   IbaEOT=          $0004;  (* Send EOI with last data byte?                *)
   IbaPPC=          $0005;  (* Parallel Poll Configure                      *)
   IbaREADDR=       $0006;  (* Repeat Addressing                            *)
   IbaAUTOPOLL=     $0007;  (* Disable Auto Serial Polling                  *)
   IbaCICPROT=      $0008;  (* Use the CIC Protocol?                        *)
   IbaIRQ=          $0009;  (* Use PIO for I/O                              *)
   IbaSC=           $000A;  (* Board is System Controller.                  *)
   IbaSRE=          $000B;  (* Assert SRE on device calls?                  *)
   IbaEOSrd=        $000C;  (* Terminate reads on EOS.                      *)
   IbaEOSwrt=       $000D;  (* Send EOI with EOS character.                 *)
   IbaEOScmp=       $000E;  (* Use 7 or 8-bit EOS compare.                  *)
   IbaEOSchar=      $000F;  (* The EOS character.                           *)
   IbaPP2=          $0010;  (* Use Parallel Poll Mode 2.                    *)
   IbaTIMING=       $0011;  (* NORMAL, HIGH, or VERY_HIGH timing.           *)
   IbaDMA=          $0012;  (* Use DMA for I/O.                             *)
   IbaReadAdjust=   $0013;  (* Swap bytes during an ibrd.                   *)
   IbaWriteAdjust=  $0014;  (* Swap bytes during an ibwrt.                  *)
   IbaEventQueue=   $0015;  (* Enable/disable the event queue.              *)
   IbaSPollBit=     $0016;  (* Enable/disable the visibility of SPOLL.      *)
   IbaSendLLO=      $0017;  (* Enable/disable the sending of LLO.           *)
   IbaSPollTime=    $0018;  (* Set the timeout value for serial polls.      *)
   IbaPPollTime=    $0019;  (* Set the parallel poll length period.         *)
   IbaNoEndBitOnEOS= $001A; (* Remove EOS from END bit of IBSTA.            *)
   IbaUnAddr=        $001B; (* Enable/disable device unaddressing.          *)
   IbaBNA=          $0200;  (* A device's access board.                     *)
   IbaBaseAddr=     $0201;  (* A GPIB board's base I/O address.             *)
   IbaDmaChannel=   $0202;  (* A GPIB board's DMA channel.                  *)
   IbaIrqLevel=     $0203;  (* A GPIB board's IRQ level.                    *)
   IbaBaud=         $0204;  (* Baud rate used to communicate to CT box.     *)
   IbaParity=       $0205;  (* Parity setting for CT box.                   *)
   IbaStopBits=     $0206;  (* Stop bits used for communicating to CT.      *)
   IbaDataBits=     $0207;  (* Data bits used for communicating to CT.      *)
   IbaComPort=      $0208;  (* System COM port used for CT box.             *)
   IbaComIrqLevel=  $0209;  (* System COM port's interrupt level.           *)
   IbaComPortBase=  $020A;  (* System COM port's base I/O address.          *)

(*  The following values are used by the iblines function.  The unsigned    *)    
(*  integer returned by iblines contains:                                   *)
(*       The lower byte will contain a "monitor" bit mask.  If a bit is     *)
(*          set (1) in this mask, then the corresponding line can be        *)
(*          monitiored by the driver.  If the bit is clear (0),             *)
(*          then the line cannot be monitored.                              *)
(*       The upper byte will contain the status of the bus lines.           *)
(*          Each bit corresponds to a certain bus line, and has             *)
(*          a correcponding "monitor" bit in the lower byte.                *)
(*
   ValidEOI=      $0080;
   ValidATN=      $0040;
   ValidSRQ=      $0020;
   ValidREN=      $0010;
   ValidIFC=      $0008;
   ValidNRFD=     $0004;
   ValidNDAC=     $0002;
   ValidDAV=      $0001;
   BusEOI=        $8000;
   BusATN=        $4000;
   BusSRQ=        $2000;
   BusREN=        $1000;
   BusIFC=        $0800;
   BusNRFD=       $0400;
   BusNDAC=       $0200;
   BusDAV=        $0100;

(****************************************************************************)

Type   Addrlist = array [0..255] of integer;
       cbuf = array [1..255] of char;

const
 ibsta: Integer=0;   		(* status word                              *)
 iberr: Integer=0;   		(* GPIB error code                          *)
 ibcntl: LongInt=0;   		(* number of bytes sent or DOS error        *)
var
 ibcnt: Integer absolute ibcntl;{# 16bit variant }
 rval: Integer;			{# return value of 488.1 functions }

(***************************************************************************)
(* Explicitly import the GPIB.DLL direct-entry functions ... *)

function DLLibclr (ud: integer; var ibsta,iberr: integer;
			var ibcntl: longint): integer;
function DLLibloc (ud: integer; var ibsta,iberr: integer;
			var ibcntl: longint): integer;
function DLLibpct (ud: integer; var ibsta,iberr: integer;
			var ibcntl: longint): integer;
function DLLibsic (ud: integer; var ibsta,iberr: integer;
			var ibcntl: longint): integer;
function DLLibstop (ud: integer; var ibsta,iberr: integer;
			var ibcntl: longint): integer;
function DLLibtrg (ud: integer; var ibsta,iberr: integer;
			var ibcntl: longint): integer;
function DLLibcac (ud: integer; v: integer; var ibsta,iberr: integer;
			var ibcntl: longint): integer;
function DLLibdma (ud: integer; v: integer; var ibsta,iberr: integer;
			var ibcntl: longint): integer;
function DLLibeos (ud: integer; v: integer; var ibsta,iberr: integer;
			var ibcntl: longint): integer;
function DLLibeot (ud: integer; v: integer; var ibsta,iberr: integer;
			var ibcntl: longint): integer;
function DLLibgts (ud: integer; v: integer; var ibsta,iberr: integer;
			var ibcntl: longint): integer;
function DLLibist (ud: integer; v: integer; var ibsta,iberr: integer;
			var ibcntl: longint): integer;
function DLLibonl (ud: integer; v: integer; var ibsta,iberr: integer;
			var ibcntl: longint): integer;
function DLLibpad (ud: integer; v: integer; var ibsta,iberr: integer;
			var ibcntl: longint): integer;
function DLLibppc (ud: integer; v: integer; var ibsta,iberr: integer;
			var ibcntl: longint): integer;
function DLLibrsc (ud: integer; v: integer; var ibsta,iberr: integer;
			var ibcntl: longint) : integer;
function DLLibrsv (ud: integer; v: integer; var ibsta,iberr: integer;
			var ibcntl: longint) : integer;
function DLLibsad (ud: integer; v: integer; var ibsta,iberr: integer;
			var ibcntl: longint) : integer;
function DLLibsre (ud: integer; v: integer; var ibsta,iberr: integer;
			var ibcntl: longint) : integer;
function DLLibtmo (ud: integer; v: integer; var ibsta,iberr: integer;
			var ibcntl: longint) : integer;
function DLLibwait (ud: integer; mask: word; var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;

function DLLibask (ud: integer; option: integer; var retval: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibbna (ud: integer; udname: PChar; var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibcmd (ud: integer; var buf; cnt: longint;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibcmda (ud: integer; var buf; cnt: longint;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibdiag (ud: integer; var buf; cnt: longint;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibevent (ud: integer; var event: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLiblines (ud: integer; var result: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibrd (ud: integer; var buf; cnt: longint;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibrda (ud: integer; var buf; cnt: longint;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibrdf (ud: integer; filename: PChar;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibrdkey (ud: integer; var buf; cnt: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibrpp (ud: integer; var ppr : integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibrsp (ud: integer; var spr : integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibwrt (ud: integer; const buf; cnt: longint;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibwrta (ud: integer; const buf; cnt: longint;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibwrtf (ud: integer; filename : PChar;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibwrtkey (ud: integer; const buf; cnt: integer;
			 var ibsta,iberr: Integer;
			 var ibcntl: longint) : integer;
function DLLibfind (udname : PChar;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibconfig (bdid: integer; option: integer; v: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibpoke (ud: integer; option: integer; v: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibdev (ud: integer; pad: integer; sad: integer; tmo: integer;
			eot: integer; eos: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;
function DLLibln (ud: integer; pad: integer; sad: integer;
			var listen: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint) : integer;

procedure DLLSendCmds(boardID: integer; const buf; cnt: longint;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLSendSetup(boardID: integer; listen: Addrlist;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLSendDataBytes(boardID: integer;
			const buffer; cnt: longint; eot_mode: Word;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLSend(boardID: integer; listener: integer;
			const databuf; datacnt: longint; eotMode: Word;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLSendList(boardID: integer; var listeners: Addrlist;
			const databuf; datacnt: longint; eotMode: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLReceiveSetup(boardID: integer; talker: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLRcvRespMsg(boardID: integer;
			var buffer; cnt: longint; eotMode: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLReceive(boardID: integer; talker: integer;
			var buf; cnt: longint; eotMode: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLSendIFC(boardID: integer; var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLDevClear(boardID: integer; address: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLDevClearList(boardID: integer; var addrlist: Addrlist;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLEnableLocal(boardID: integer; var laddrs: Addrlist;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLEnableRemote(boardID: integer; var laddrs: Addrlist;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLSetRWLS(boardID: integer; var laddrs: Addrlist;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLSendLLO(boardID: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLPassControl(boardID: integer; talker: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLReadStatusByte(boardID: integer; talker: integer;
			var result: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLTrigger(boardID: integer; laddrs: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLTriggerList(boardID: integer; var laddrs: Addrlist;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLPPollConfig(boardID: integer; laddr: Word; dataLine: Word;
			lineSense: Word;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLPPollUnconfig(boardID: integer; var laddrs: Addrlist;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLPPoll(boardID: integer; var res_ptr: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLTestSRQ(boardID: integer; var result: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLWaitSRQ(boardID: integer; var result: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLResetSys(boardID: integer; var laddrs: Addrlist;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLFindRQS(boardID: integer; var taddrs: Addrlist;
			var dev_stat: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLAllSpoll(boardID: integer; var taddrs: Addrlist; res: Addrlist;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLFindLstn(boardID: integer; var pads: Addrlist;
			var results: Addrlist; limit: integer;
			var ibsta,iberr: Integer;
			var ibcntl: longint);
procedure DLLTestSys(boardID: integer; var addrs: Addrlist;
			var result: Addrlist;
			var ibsta,iberr: Integer;
			var ibcntl: longint);


(***************************************************************************)
(* The GPIB board functions declared public by the TPW_GPIB unit:          *)
(***************************************************************************)

procedure  ibask   (bd:integer; option:integer; var retval : integer);
procedure  ibbna   (bd:integer; bname: PChar);
procedure  ibcac   (bd:integer; v:integer);
procedure  ibclr   (bd:integer);
procedure  ibcmd   (bd:integer; var cmd; cnt:longInt);
procedure  ibcmda  (bd:integer; var cmd; cnt:longInt);
procedure  ibconfig (bd:integer; option:integer; v:integer);
procedure  ibdiag   (bd:integer; var rd; cnt:longInt);
function   ibdev    (boardID:integer; pad:integer; sad:integer; tmo:integer;
			 eot:integer; eos:integer):integer;
procedure  ibdma   (bd:integer; v:integer);
procedure  ibeos   (bd:integer; v:integer);
procedure  ibeot   (bd:integer; v:integer);
procedure  ibevent (bd:integer; var event:integer);
function   ibfind  (bdname:PChar) : integer;
procedure  ibgts   (bd:integer; v:integer);
procedure  ibist   (bd:integer; v:integer);
procedure  iblines (bd:integer; var lines:integer);
procedure  ibln    (bd:integer; pad:integer; sad:integer; var listen:integer);
procedure  ibloc   (bd:integer);
procedure  ibonl   (bd:integer; v:integer);
procedure  ibpad   (bd:integer; v:integer);
procedure  ibpct   (bd:integer);
procedure  ibpoke  (bd:integer; option:integer; v:integer);
procedure  ibppc   (bd:integer; v:integer);
procedure  ibrd    (bd:integer; var rd; cnt:longInt);
procedure  ibrda   (bd:integer; var rd; cnt:longInt);
procedure  ibrdf   (bd:integer; flname:PChar);
procedure  ibrpp   (bd:integer; var ppr:integer);
procedure  ibrsc   (bd:integer; v:integer);
procedure  ibrsp   (bd:integer; var spr:integer);
procedure  ibrsv   (bd:integer; v:integer);
procedure  ibsad   (bd:integer; v:integer);
procedure  ibsic   (bd:integer);
procedure  ibsre   (bd:integer; v:integer);
procedure  ibstop  (bd:integer);
procedure  ibtmo   (bd:integer; v:integer);
procedure  ibtrg   (bd:integer);
procedure  ibwait  (bd:integer; mask:word);
procedure  ibwrt   (bd:integer; const wrt; cnt:longInt);
procedure  ibwrta  (bd:integer; const wrt; cnt:longInt);
procedure  ibwrtf  (bd:integer; flname:PChar);
procedure  ibwrtkey (bd:integer; const wrt; cnt:longInt);
procedure  ibrdkey  (bd:integer; var rd; cnt:longInt);

(************************** The 488.2 functions ****************************)

procedure  SendCmds (boardID:integer; var buf; cnt:longInt);
procedure  SendSetup (boardID:integer; var listeners:Addrlist);
procedure  SendDataBytes (boardID:integer; var buf; cnt:longInt;
		eot_mode:integer);
procedure  Send (boardID:integer; listener:integer;
		var databuf; datacnt:longInt;
                eot_mode:integer);
procedure  SendList (boardID:integer; var listeners:Addrlist;
                var databuf; datacnt:longInt;
                eot_mode:integer); 
procedure  ReceiveSetup (boardID:integer; talker:integer);
procedure  RcvRespMsg (boardID:integer; var buf; cnt:longInt;
                eot_mode:integer);
procedure  Receive (boardID:integer; talker:integer; var buf;
                cnt:longInt; eot_mode:integer); 
procedure  SendIFC (boardID:integer);
procedure  DevClear (boardID:integer; laddr:integer);
procedure  DevClearList (boardID:integer; var laddrs:Addrlist);
procedure  EnableLocal (boardID:integer; var laddrs:Addrlist);
procedure  EnableRemote (boardID:integer; var laddrs:Addrlist);
procedure  SetRWLS (boardID:integer; var laddrs:Addrlist);
procedure  SendLLO (boardID:integer);
procedure  PassControl (boardID:integer; talker:integer);
procedure  ReadStatusByte (boardID:integer; talker:integer;
                var result:integer); 
procedure  Trigger (boardID:integer; laddr:integer);
procedure  TriggerList (boardID:integer; var laddrs:Addrlist);
procedure  PPollConfig (boardID:integer; laddr:integer; dataline:integer;
                linesense:integer); 
procedure  PPollUnconfig (boardID:integer; var laddrs:Addrlist);
procedure  PPoll (boardID:integer; var res_ptr:integer);
procedure  ResetSys (boardID:integer; var laddrs:Addrlist);
procedure  FindRQS (boardID:integer; var taddrs:Addrlist;
		var dev_stat:integer);
procedure  AllSpoll (boardID:integer; var taddrs:Addrlist;
		var res:Addrlist);
procedure  FindLstn (boardID:integer; var pads:Addrlist;
		var result:Addrlist; limit:integer);
procedure  TestSys (boardID:integer; var addrs:addrlist;
		var result:addrlist);
procedure  TestSRQ (boardID:integer; var result:integer);
procedure  WaitSRQ (boardID:integer; var result:integer);


(***************************************************************************)
(***************************************************************************)

IMPLEMENTATION

(***************************************************************************)
(*  The GPIB direct entry functions externed from GPIB.DLL                 *)
function DLLibask;     external 'GPIB' index 55;
function DLLibbna;     external 'GPIB' index 10;
function DLLibcac;     external 'GPIB' index 11;
function DLLibclr;     external 'GPIB' index 12;
function DLLibcmd;     external 'GPIB' index 13;
function DLLibcmda;    external 'GPIB' index 14;
function DLLibconfig;  external 'GPIB' index 15;
function DLLibdev;     external 'GPIB' index 16;
function DLLibdiag;    external 'GPIB' index 17;
function DLLibdma;     external 'GPIB' index 18;
function DLLibeos;     external 'GPIB' index 19;
function DLLibeot;     external 'GPIB' index 20;
function DLLibevent;   external 'GPIB' index 21;
function DLLibfind;    external 'GPIB' index 22;
function DLLibgts;     external 'GPIB' index 23;
function DLLibist;     external 'GPIB' index 24;
function DLLiblines;   external 'GPIB' index 25;
function DLLibln;      external 'GPIB' index 26;
function DLLibloc;     external 'GPIB' index 27;
function DLLibonl;     external 'GPIB' index 28;
function DLLibpad;     external 'GPIB' index 29;
function DLLibpct;     external 'GPIB' index 30;
function DLLibpoke;    external 'GPIB' index 31;
function DLLibppc;     external 'GPIB' index 32;
function DLLibrd;      external 'GPIB' index 33;
function DLLibrda;     external 'GPIB' index 34;
function DLLibrdf;     external 'GPIB' index 35;
function DLLibrdkey;   external 'GPIB' index 36;
function DLLibrpp;     external 'GPIB' index 37;
function DLLibrsc;     external 'GPIB' index 38;
function DLLibrsp;     external 'GPIB' index 39;
function DLLibrsv;     external 'GPIB' index 40;
function DLLibsad;     external 'GPIB' index 41;
function DLLibsic;     external 'GPIB' index 42;
function DLLibsre;     external 'GPIB' index 43;
function DLLibstop;    external 'GPIB' index 44;
function DLLibtmo;     external 'GPIB' index 45;
function DLLibtrg;     external 'GPIB' index 46;
function DLLibwait;    external 'GPIB' index 47;
function DLLibwrt;     external 'GPIB' index 48;
function DLLibwrta;    external 'GPIB' index 49;
function DLLibwrtf;    external 'GPIB' index 50;
function DLLibwrtkey;  external 'GPIB' index 51;

procedure DLLAllSpoll;        external 'GPIB' index 100;
procedure DLLDevClear;        external 'GPIB' index 101;
procedure DLLDevClearList;    external 'GPIB' index 102;
procedure DLLEnableLocal;     external 'GPIB' index 103;
procedure DLLEnableRemote;    external 'GPIB' index 104;
procedure DLLFindLstn;        external 'GPIB' index 105;
procedure DLLFindRQS;         external 'GPIB' index 106;
procedure DLLPassControl;     external 'GPIB' index 107;
procedure DLLPPoll;           external 'GPIB' index 108;
procedure DLLPPollConfig;     external 'GPIB' index 109;
procedure DLLPPollUnconfig;   external 'GPIB' index 110;
procedure DLLRcvRespMsg;      external 'GPIB' index 111;
procedure DLLReadStatusByte;  external 'GPIB' index 112;
procedure DLLReceive;         external 'GPIB' index 113;
procedure DLLReceiveSetup;    external 'GPIB' index 114;
procedure DLLResetSys;        external 'GPIB' index 115;
procedure DLLSend;            external 'GPIB' index 116;
procedure DLLSendCmds;        external 'GPIB' index 117;
procedure DLLSendDataBytes;   external 'GPIB' index 118;
procedure DLLSendIFC;         external 'GPIB' index 119;
procedure DLLSendList;        external 'GPIB' index 120;
procedure DLLSendLLO;         external 'GPIB' index 121;
procedure DLLSendSetup;       external 'GPIB' index 122;
procedure DLLSetRWLS;         external 'GPIB' index 123;
procedure DLLTestSRQ;         external 'GPIB' index 124;
procedure DLLTestSys;         external 'GPIB' index 125;
procedure DLLTrigger;         external 'GPIB' index 126;
procedure DLLTriggerList;     external 'GPIB' index 127;
procedure DLLWaitSRQ;         external 'GPIB' index 128;


(***************************************************************************)
(* The GPIB board functions                                                *)

procedure ibask (bd:integer; option:integer; var retval:integer);
 begin
  rval  := DLLibask (bd, option, retval, ibsta, iberr, ibcntl);
 end;

procedure ibbna (bd:integer; bname:PChar);
 begin
  rval := DLLibbna (bd, bname, ibsta, iberr, ibcntl);
 end;

procedure ibcac  (bd:integer; v:integer);
   begin
	rval := DLLibcac  (bd, v, ibsta, iberr, ibcntl);
   end;

procedure ibclr  (bd:integer);
   begin
        rval := DLLibclr (bd, ibsta, iberr, ibcntl);
   end;

procedure ibcmd  (bd:integer; var cmd; cnt:longInt);
   begin
        rval := DLLibcmd (bd, cmd, cnt, ibsta, iberr, ibcntl);
   end;

procedure ibcmda (bd:integer; var cmd; cnt:longInt);
   begin
        rval := DLLibcmda (bd, cmd, cnt, ibsta, iberr, ibcntl);
   end;

procedure ibconfig (bd:integer; option:integer; v:integer);
   begin
        rval := DLLibconfig (bd, option, v, ibsta, iberr, ibcntl);
   end;

procedure ibdiag (bd:integer; var rd; cnt:longInt);
   begin
        rval := DLLibdiag (bd, rd, cnt, ibsta, iberr, ibcntl);
   end;

function  ibdev  (boardID:integer; pad:integer; sad:integer; tmo:integer; eot:integer; eos:integer) : integer;
   begin
        ibdev := DLLibdev  (boardID, pad, sad, tmo, eot, eos, ibsta, iberr, ibcntl);
   end;

procedure ibdma  (bd:integer; v:integer);
   begin
        rval := DLLibdma  (bd, v, ibsta, iberr, ibcntl);
   end;

procedure  ibeos  (bd:integer; v:integer);
   begin
        rval := DLLibeos  (bd, v, ibsta, iberr, ibcntl);
   end;

procedure ibeot  (bd:integer; v:integer);
   begin
        rval := DLLibeot  (bd, v, ibsta, iberr, ibcntl);
   end;

procedure  ibevent  (bd:integer; var event:integer);
   begin
        rval  := DLLibevent  (bd, event, ibsta, iberr, ibcntl);
   end;

function ibfind (bdname:PChar) : integer;
   begin
        ibfind := DLLibfind (bdname, ibsta, iberr, ibcntl);
   end;

procedure ibgts  (bd:integer; v:integer);
   begin
        rval := DLLibgts  (bd, v, ibsta, iberr, ibcntl);
   end;

procedure ibist  (bd:integer; v:integer);
   begin
        rval := DLLibist  (bd, v, ibsta, iberr, ibcntl);
   end;

procedure iblines  (bd:integer; var lines:integer);
   begin
        rval := DLLiblines  (bd, lines, ibsta, iberr, ibcntl);
   end;

procedure ibln  (bd:integer; pad:integer; sad:integer; var listen:integer);
   begin
        rval := DLLibln   (bd, pad, sad, listen, ibsta, iberr, ibcntl);
   end;

procedure ibloc  (bd:integer);
   begin
        rval := DLLibloc  (bd, ibsta, iberr, ibcntl);
   end;

procedure ibonl  (bd:integer; v:integer);
   begin
        rval := DLLibonl  (bd, v, ibsta, iberr, ibcntl);
   end;

procedure ibpad  (bd:integer; v:integer);
   begin
        rval := DLLibpad  (bd, v, ibsta, iberr, ibcntl);
   end;

procedure ibpct  (bd:integer);
   begin
        rval := DLLibpct  (bd, ibsta, iberr, ibcntl);
   end;

procedure ibpoke (bd:integer; option:integer; v:integer);
   begin
        rval := DLLibpoke (bd, option, v, ibsta, iberr, ibcntl);
   end;

procedure ibppc  (bd:integer; v:integer);
   begin
        rval := DLLibppc  (bd, v, ibsta, iberr, ibcntl);
   end;

procedure ibrd   (bd:integer; var rd; cnt:longInt);
   begin
        rval := DLLibrd   (bd, rd, cnt, ibsta, iberr, ibcntl);
   end;

procedure ibrda  (bd:integer; var rd; cnt:longInt);
   begin
        rval := DLLibrda  (bd, rd, cnt, ibsta, iberr, ibcntl);
   end;

procedure ibrdf  (bd:integer; flname:PChar);
   begin
        rval := DLLibrdf  (bd, flname, ibsta, iberr, ibcntl);
   end;

procedure ibrpp  (bd:integer; var ppr:integer);
   begin
        rval := DLLibrpp  (bd, ppr, ibsta, iberr, ibcntl);
   end;

procedure ibrsc  (bd:integer; v:integer);
   begin
        rval := DLLibrsc  (bd, v, ibsta, iberr, ibcntl);
   end;

procedure  ibrsp  (bd:integer; var spr:integer);
   begin
        rval  := DLLibrsp  (bd, spr, ibsta, iberr, ibcntl);
   end;

procedure ibrsv  (bd:integer; v:integer);
   begin
        rval := DLLibrsv  (bd, v, ibsta, iberr, ibcntl);
   end;

procedure ibsad  (bd:integer; v:integer);
   begin
        rval := DLLibsad  (bd, v, ibsta, iberr, ibcntl);
   end;

procedure ibsic  (bd:integer);
   begin
        rval := DLLibsic  (bd, ibsta, iberr, ibcntl);
   end;

procedure ibsre  (bd:integer; v:integer);
   begin
        rval := DLLibsre  (bd, v, ibsta, iberr, ibcntl);
   end;

procedure ibstop (bd:integer);
   begin
	rval := DLLibstop (bd, ibsta, iberr, ibcntl);
   end;

procedure ibtmo  (bd:integer; v:integer);
   begin
        rval := DLLibtmo  (bd, v, ibsta, iberr, ibcntl);
   end;

procedure ibtrg  (bd:integer);
   begin
        rval := DLLibtrg  (bd, ibsta, iberr, ibcntl);
   end;

procedure ibwait (bd:integer; mask:word);
   begin
        rval := DLLibwait (bd, mask, ibsta, iberr, ibcntl);
   end;

procedure ibwrt  (bd:integer; const wrt; cnt:longInt);
   begin
	rval := DLLibwrt  (bd, wrt, cnt, ibsta, iberr, ibcntl);
   end;

procedure ibwrta (bd:integer; const wrt; cnt:longInt);
   begin
	rval := DLLibwrta (bd, wrt, cnt, ibsta, iberr, ibcntl);
   end;

procedure ibwrtf (bd:integer; flname:PChar);
   begin
	rval := DLLibwrtf (bd, flname, ibsta, iberr, ibcntl);
   end;

procedure ibwrtkey (bd:integer; const wrt; cnt:longInt);
   begin
        rval := DLLibwrtkey (bd, wrt, cnt, ibsta, iberr, ibcntl);
   end;

procedure ibrdkey (bd:integer; var rd; cnt:longInt);
   begin
        rval := DLLibrdkey (bd, rd, cnt, ibsta, iberr, ibcntl);
   end;


(*********************** The 488.2 entry points ************************)

procedure  AllSpoll (boardID:integer; var taddrs:Addrlist; var res:Addrlist);
   begin
        DLLAllSpoll (boardID, taddrs, res, ibsta, iberr, ibcntl);
   end;

procedure  DevClear (boardID:integer; laddr:integer);
   begin
        DLLDevClear (boardID, laddr, ibsta, iberr, ibcntl);
   end;

procedure  DevClearList (boardID:integer; var laddrs:Addrlist);
   begin
	DLLDevClearList (boardID, laddrs, ibsta, iberr, ibcntl);
   end;

procedure  EnableLocal (boardID:integer; var laddrs:Addrlist);
   begin
        DLLEnableLocal (boardID, laddrs, ibsta, iberr, ibcntl);
   end;

procedure  EnableRemote (boardID:integer; var laddrs:Addrlist);
   begin
        DLLEnableRemote (boardID, laddrs, ibsta, iberr, ibcntl);
   end;

procedure  FindLstn (boardID:integer; var pads:Addrlist; var result:Addrlist; limit:integer);
   begin
        DLLFindLstn (boardID, pads, result, limit, ibsta, iberr, ibcntl);
   end;

procedure  FindRQS (boardID:integer; var taddrs:Addrlist; var dev_stat:integer);
   begin
	DLLFindRQS (boardID, taddrs, dev_stat, ibsta, iberr, ibcntl);
   end;

procedure  PPoll (boardID:integer; var res_ptr:integer);
   begin
        DLLPPoll (boardID, res_ptr, ibsta, iberr, ibcntl);
   end;

procedure  PPollConfig (boardID:integer; laddr:integer; dataline:integer; linesense:integer);
   begin
        DLLPPollConfig (boardID, laddr, dataline, linesense, ibsta, iberr, ibcntl);
   end;

procedure  PPollUnconfig (boardID:integer; var laddrs:Addrlist);
   begin
        DLLPPollUnconfig (boardID, laddrs, ibsta, iberr, ibcntl);
   end;

procedure  PassControl (boardID:integer; talker:integer);
   begin
	DLLPassControl (boardID, talker, ibsta, iberr, ibcntl);
   end;

procedure  RcvRespMsg (boardID:integer; var buf; cnt:longInt; eot_mode:integer);
   begin
        DLLRcvRespMsg (boardID, buf, cnt, eot_mode, ibsta, iberr, ibcntl);
   end;

procedure  ReadStatusByte (boardID:integer; talker:integer; var result:integer);
   begin
        DLLReadStatusByte (boardID, talker, result, ibsta, iberr, ibcntl);
   end;

procedure  Receive (boardID:integer; talker:integer; var buf;  cnt:longInt; eot_mode:integer);
   begin
        DLLReceive (boardID, talker, buf, cnt, eot_mode, ibsta, iberr, ibcntl);
   end;

procedure  ReceiveSetup (boardID:integer; talker:integer);
   begin
	DLLReceiveSetup (boardID, talker, ibsta, iberr, ibcntl);
   end;

procedure  ResetSys (boardID:integer; var laddrs:Addrlist);
   begin
        DLLResetSys (boardID, laddrs, ibsta, iberr, ibcntl);
   end;

procedure  Send (boardID:integer; listener:integer; var databuf; datacnt:longInt; eot_mode:integer);
   begin
        DLLSend (boardID, listener, databuf, datacnt, eot_mode, ibsta, iberr, ibcntl);
   end;

procedure  SendCmds (boardID:integer; var buf; cnt:longInt);
   begin
        DLLSendCmds (boardID, buf, cnt, ibsta, iberr, ibcntl);
   end;

procedure  SendDataBytes (boardID:integer; var buf; cnt:longInt; eot_mode:integer);
   begin
	DLLSendDataBytes (boardID, buf, cnt, eot_mode, ibsta, iberr, ibcntl);
   end;

procedure  SendIFC (boardID:integer);
   begin
        DLLSendIFC (boardID, ibsta, iberr, ibcntl);
   end;

procedure  SendLLO (boardID:integer);
   begin
        DLLSendLLO (boardID, ibsta, iberr, ibcntl);
   end;

procedure  SendList (boardID:integer; var listeners:Addrlist;  var databuf; datacnt:longInt; eot_mode:integer);
   begin
        DLLSendList (boardID, listeners, databuf, datacnt, eot_mode, ibsta, iberr, ibcntl);
   end;

procedure  SendSetup (boardID:integer; var listeners:Addrlist);
   begin
	DLLSendSetup (boardID, listeners, ibsta, iberr, ibcntl);
   end;

procedure  SetRWLS (boardID:integer; var laddrs:Addrlist);
   begin
        DLLSetRWLS (boardID, laddrs, ibsta, iberr, ibcntl);
   end;

procedure  TestSRQ (boardID:integer; var result:integer);
   begin
        DLLTestSRQ (boardID, result, ibsta, iberr, ibcntl);
   end;

procedure  TestSys (boardID:integer; var addrs:Addrlist; var result:Addrlist);
   begin
        DLLTestSys (boardID, addrs, result, ibsta, iberr, ibcntl);
   end;

procedure  Trigger (boardID:integer; laddr:integer);
   begin
	DLLTrigger (boardID, laddr, ibsta, iberr, ibcntl);
   end;

procedure  TriggerList (boardID:integer; var laddrs:Addrlist);
   begin
        DLLTriggerList (boardID, laddrs, ibsta, iberr, ibcntl);
   end;

procedure  WaitSRQ (boardID:integer; var result:integer);
   begin
        DLLWaitSRQ (boardID, result, ibsta, iberr, ibcntl);
   end;


(***************************************************************************)
{# No Unit Initialization Routine }
(***************************************************************************)
end.
Detected encoding: ASCII (7 bit)2