Software
Borland Delphi (Pascal) Programming Interface
(c) Spectrum GmbH
47
Borland Delphi (Pascal) Programming Interface
Driver interface
The driver interface is located in the sub-directory d_header and contains the following files. The files need to be included in the delphi project
and has to be put into the „uses“ section of the source files that will access the driver. Please do not edit any of these files as they’re regularly
updated if new functions or registers have been included.
file spcm_win32.pas
The file contains the interface to the driver library and defines some needed constants and variable types. All functions of the delphi library
are similar to the above explained standard driver functions:
The file also defines types used inside the driver and the examples. The types have similar names as used under C/C++ to keep the examples
more simple to understand and allow a better comparison.
file SpcRegs.pas
The SpcRegs.pas file defines all constants that are used for the driver. The constant names are the same names as used under the C/C++
examples. All constants names will be found throughout this hardware manual when certain aspects of the driver usage are explained. It is
recommended to only use these constant names for better visibility of the programs:
file SpcErr.pas
The SpeErr.pas file contains all error codes that may be returned by the driver.
Including the driver files
To use the driver function and all the defined constants it is necessary to include the files into the project as
shown in the picture on the right. The project overview is taken from one of the examples delivered on CD.
Besides including the driver files in the project it is also necessary to include them in the uses section of the
source files where functions or constants should be used:
// ----- device handling functions -----
function spcm_hOpen (strName: pchar): int32; stdcall; external 'spcm_win32.dll' name '_spcm_hOpen@4';
procedure spcm_vClose (hDevice: int32); stdcall; external 'spcm_win32.dll' name '_spcm_vClose@4';
function spcm_dwGetErrorInfo_i32 (hDevice: int32; var lErrorReg, lErrorValue: int32; strError: pchar): uint32;
stdcall; external 'spcm_win32.dll' name '_spcm_dwGetErrorInfo_i32@16'
// ----- register access functions -----
function spcm_dwSetParam_i32 (hDevice, lRegister, lValue: int32): uint32;
stdcall; external 'spcm_win32.dll' name '_spcm_dwSetParam_i32@12';
function spcm_dwSetParam_i64 (hDevice, lRegister: int32; llValue: int64): uint32;
stdcall; external 'spcm_win32.dll' name '_spcm_dwSetParam_i64@16';
function spcm_dwGetParam_i32 (hDevice, lRegister: int32; var plValue: int32): uint32;
stdcall; external 'spcm_win32.dll' name '_spcm_dwGetParam_i32@12';
function spcm_dwGetParam_i64 (hDevice, lRegister: int32; var pllValue: int64): uint32;
stdcall; external 'spcm_win32.dll' name '_spcm_dwGetParam_i64@12';
// ----- data handling -----
function spcm_dwDefTransfer_i64 (hDevice, dwBufType, dwDirection, dwNotifySize: int32; pvDataBuffer: Pointer;
llBrdOffs, llTransferLen: int64): uint32;
stdcall; external 'spcm_win32.dll' name '_spcm_dwDefTransfer_i64@36';
function spcm_dwInvalidateBuf (hDevice, lBuffer: int32): uint32;
stdcall; external 'spcm_win32.dll' name '_spcm_dwInvalidateBuf@8';
const SPC_M2CMD = 100; { write a command }
const M2CMD_CARD_RESET = $00000001; { hardware reset }
const M2CMD_CARD_WRITESETUP = $00000002; { write setup only }
const M2CMD_CARD_START = $00000004; { start of card (including writesetup) }
const M2CMD_CARD_ENABLETRIGGER = $00000008; { enable trigger engine }
...
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls,
SpcRegs, SpcErr, spcm_win32;