{$define GT_ISA}
//{$define GT_PCI}
{$define GT_SV}
//{$define GT_SG}
//{$define GT_SP}
//{$define GT_SD}

unit GTFuncI;

interface

uses  GlobalVarConst;

const
{$ifndef GT_ISA}
  GTDll = 'GTDll.dll';   //for ISA interface
{$else}
  GTDll = 'GT400.dll';
{$endif}
 
  Intr_GT_AxisI   =    $34;
  Intr_GT_RstIntr =    $22;
  Intr_GT_Axis1   =    $30;
  Intr_GT_Axis2   =    $31;
  Intr_GT_Axis3   =    $32;
  Intr_GT_Axis4   =    $33;
  Intr_GT_PrflT   =       $1;
  Intr_GT_PrflS   =       $2;
  Intr_GT_PrflV   =       $4;
  Intr_GT_PrflG   =       $5;
  Intr_GT_SetPos  =       $41;
  Intr_GT_SetVel  =       $42;
  Intr_GT_SetAcc  =       $43;
  Intr_GT_SetMAcc =       $48;
  Intr_GT_SetJerk =       $44;
  Intr_GT_SetRatio=       $45;
  Intr_GT_SmthStp =       $11;
  Intr_GT_AbptStp =       $12;
  Intr_GT_ZeroPos =       $15;
  Intr_GT_SynchPos=       $14;
  Intr_GT_SetAtlPos=      $27;
  Intr_GT_GetPos   =      $a1;
  Intr_GT_GetVel   =      $a2;
  Intr_GT_GetAcc   =      $a3;
  Intr_GT_GetMAcc  =      $a8;
  Intr_GT_GetJerk  =      $a4;
  Intr_GT_GetRatio =      $a5;
  Intr_GT_GetAtlPos=      $c2;
  Intr_GT_SetKp    =      $4c;
  Intr_GT_SetKi    =      $4d;
  Intr_GT_SetKd    =      $4e;
  Intr_GT_SetKvff  =      $4f;
  Intr_GT_SetKaff  =      $50;
  Intr_GT_SetILmt  =      $51;
  Intr_GT_SetMtrLmt=      $4a;
  Intr_GT_SetMtrBias=     $4b;
  Intr_GT_SetPosErr =     $52;
  Intr_GT_GetKp     =     $ac;
  Intr_GT_GetKi     =     $ad;
  Intr_GT_GetKd     =     $ae;
  Intr_GT_GetKvff   =     $af;
  Intr_GT_GetKaff   =     $b0;
  Intr_GT_GetILmt   =     $b1;
  Intr_GT_GetMtrLmt =     $aa;
  Intr_GT_GetMtrBias=     $ab;
  Intr_GT_GetPosErr =     $b2;
  Intr_GT_GetAtlErr =     $c3;
  Intr_GT_Intgr     =     $c5;
  Intr_GT_PosBrk    =     $1b;
  Intr_GT_NegBrk    =     $1c;
  Intr_GT_ExtBrk    =     $1d;
  Intr_GT_MtnBrk    =     $1e;
  Intr_GT_BrkOff    =     $1a;
  Intr_GT_SetBrkCn  =     $40;
  Intr_GT_Update    =     $16;
  Intr_GT_AuUpdtOn  =     $17;
  Intr_GT_AuUpdtOff =     $18;
  Intr_GT_GetBrkCn  =     $a0;
  Intr_GT_ClrSts    =     $6 ;
  Intr_GT_RstSts    =     $23;
  Intr_GT_GetSts    =     $36;
  Intr_GT_GetMode   =     $37;
  Intr_GT_CaptIndex =     $7 ;
  Intr_GT_CaptHome  =     $8 ;
  Intr_GT_GetCapt   =     $3e;
  Intr_GT_GetCrdSts =     $90;
  Intr_GT_GetMtnNm  =     $91;
  Intr_GT_MltiUpdt  =     $20;
  Intr_GT_SetIntrTm =     $26;
  Intr_GT_GetIntrTm =     $3a;
  Intr_GT_ExOpt     =     $28;
  Intr_GT_ExInpt    =     $35;
  Intr_GT_GetCmdSts =     $3d;
  Intr_GT_GetLmtSwt =     $3c;
  Intr_GT_GetSmplTm =     $3b;


//general commad record(struct) define
type GENERAL_COMMAND=record
        Cmd:word;    //command word
        InLength:word;
        OutLength:word;
        CmdResult:word;
        InUnion,OutUnion: record
               case integer of
                 1: (sdata:array[1..2]of word);
                 2: (ldata:longword);
                            end;
                      end;

//background command. it is used to hold commands that was performanced in
// interrupt service routine or DPC
type    BACKGROUND_COMMAND=record
	InterruptMask:word;
	CommandCount:word;
	GenCommand:array[1..100]of GENERAL_COMMAND;     //length of array can be changed here
                        end;

// a set of background command
type BGCOMMANDSET=record
	Count:word;
        reserved:word;
	BackgroundCommand:array[1..16]of BACKGROUND_COMMAND;
                  end;
type PBGCOMMANDSET=^BGCOMMANDSET;

//type PDouble=^Double;
type PLongWord=^LongWord;
type PLongInt=^LongInt;
type PWord=^Word;
type PSmallInt=^SmallInt;

{general functions, for all types of card }
function	GT_AbptStp: SmallInt; stdcall;
function	GT_AddList: SmallInt; stdcall;
function	GT_ArcXY(x_center,y_center,angle:Double): SmallInt; stdcall;
function	GT_ArcXYP(x_end,y_end,r:Double;dir:SmallInt): SmallInt; stdcall;
function	GT_ArcYZ(y_center,z_center,angle:Double): SmallInt; stdcall;
function	GT_ArcYZP(y_end,z_end,r:Double;dir:SmallInt): SmallInt; stdcall;
function	GT_ArcZX(z_center,x_center,angle:Double): SmallInt; stdcall;
function	GT_ArcZXP(z_end,x_end,r:Double;dir:SmallInt): SmallInt; stdcall;
function	GT_AuUpdtOff: SmallInt; stdcall;
function	GT_AuUpdtOn: SmallInt; stdcall;
function	GT_Axis(X:Word): SmallInt; stdcall;
function	GT_AxisI: SmallInt; stdcall;
function	GT_AxisOff: SmallInt; stdcall;
function	GT_AxisOn: SmallInt; stdcall;
function	GT_BrkOff: SmallInt; stdcall;
function	GT_CaptHome: SmallInt; stdcall;
function	GT_Close: SmallInt; stdcall;
function	GT_ClrSts: SmallInt; stdcall;
function	GT_CrdAuStpOff: SmallInt; stdcall;
function	GT_CrdAuStpOn: SmallInt; stdcall;
function	GT_DrvRst: SmallInt; stdcall;
function	GT_EStpMtn: SmallInt; stdcall;
function        GT_EncPos(id:smallint;x:PLongInt):smallInt; stdcall;
function        GT_EncVel(id:smallint;x:PDouble):smallInt; stdcall;
function	GT_EndList: SmallInt; stdcall;
function	GT_EvntIntr: SmallInt; stdcall;
function	GT_ExInpt(X:PWord): SmallInt; stdcall;
function	GT_ExOpt(X:Word): SmallInt; stdcall;
function	GT_ExtBrk: SmallInt; stdcall;
function	GT_GetAcc(X:PDouble): SmallInt; stdcall;
function	GT_GetAccLmt(X:PDouble): SmallInt; stdcall;
function        GT_GetAdc(id:smallint;x:PSmallInt):smallInt; stdcall;
function	GT_GetAtlPos(X:PLongInt): SmallInt; stdcall;
function	GT_GetBrkCn(X:PLongInt): SmallInt; stdcall;
function	GT_GetBrkPnt(X:PDouble): SmallInt; stdcall;
function	GT_GetCapt(X:PLongInt): SmallInt; stdcall;
function	GT_GetCmdSts(X:PWord): SmallInt; stdcall;
function	GT_GetCrdSts(X:PWord): SmallInt; stdcall;
function	GT_GetIntr(X:PWord): SmallInt; stdcall;
function	GT_GetIntrMsk(X:PWord): SmallInt; stdcall;
function	GT_GetIntrTm(X:PWord): SmallInt; stdcall;
function	GT_GetJerk(X:PDouble): SmallInt; stdcall;
function	GT_GetLmtSwt(X:PWord): SmallInt; stdcall;
function	GT_GetMAcc(X:PDouble): SmallInt; stdcall;
function	GT_GetMode(X:PWord): SmallInt; stdcall;
function	GT_GetMtnNm(X:PWord): SmallInt; stdcall;
function	GT_GetPos(X:PLongInt): SmallInt; stdcall;
function	GT_GetPrfPnt(X:PDouble): SmallInt; stdcall;
function	GT_GetRatio(X:PDouble): SmallInt; stdcall;
function	GT_GetSmplTm(X:PDouble): SmallInt; stdcall;
function	GT_GetSts(X:PWord): SmallInt; stdcall;
function	GT_GetVel(X:PDouble): SmallInt; stdcall;
function	GT_HardRst: SmallInt; stdcall;
function	GT_LmtSns(X:Word): SmallInt; stdcall;
function	GT_LmtsOff: SmallInt; stdcall;
function	GT_LmtsOn: SmallInt; stdcall;
function	GT_LnXY(x,y:Double): SmallInt; stdcall;
function	GT_LnXYZ(x,y,z:Double): SmallInt; stdcall;
function	GT_LnXYZA(x,y,z,A:Double): SmallInt; stdcall;
function	GT_MapAxis(X:Word; y: PDouble): SmallInt; stdcall;
function	GT_MltiUpdt(X:Word): SmallInt; stdcall;
function	GT_MtnBrk: SmallInt; stdcall;
function	GT_MvXY(x,y,vel,accel:Double): SmallInt; stdcall;
function	GT_MvXYZ(x,y,z,vel,accel:Double): SmallInt; stdcall;
function	GT_MvXYZA(x,y,z,A,vel,accel:Double): SmallInt; stdcall;
function	GT_NegBrk: SmallInt; stdcall;
{$ifndef GT_ISA}
function	GT_Open(BasePort:LongWord;Irq:LongWord): SmallInt; stdcall;
{$else}
function	GT_Open(): SmallInt; stdcall;
function        GT_SwitchtoCardNo(x:word):smallint; stdcall;
function        GT_GetCurrentCardNo:smallint;stdcall;
{$endif}
function	GT_PosBrk: SmallInt; stdcall;
function	GT_PrflG(X:Word): SmallInt; stdcall;
function	GT_PrflS: SmallInt; stdcall;
function	GT_PrflT: SmallInt; stdcall;
function	GT_PrflV: SmallInt; stdcall;
function	GT_Reset: SmallInt; stdcall;
function	GT_RstIntr(X:Word): SmallInt; stdcall;
function	GT_RstSts(X:Word): SmallInt; stdcall;
function	GT_SetAcc(X:Double): SmallInt; stdcall;
function	GT_SetAccLmt(X:Double): SmallInt; stdcall;
function	GT_SetAtlPos(X:LongInt): SmallInt; stdcall;
function	GT_SetBrkCn(X:LongInt): SmallInt; stdcall;
function	GT_SetIntrMsk(X:Word): SmallInt; stdcall;
function	GT_SetIntrTm(X:Word): SmallInt; stdcall;
function	GT_SetJerk(X:Double): SmallInt; stdcall;
function	GT_SetMAcc(X:Double): SmallInt; stdcall;
function	GT_SetPos(X:LongInt): SmallInt; stdcall;
function	GT_SetRatio(X:Double): SmallInt; stdcall;
function	GT_SetSmplTm(X:Double): SmallInt; stdcall;
function	GT_SetSynAcc(X:Double): SmallInt; stdcall;
function	GT_SetSynVel(X:Double): SmallInt; stdcall;
function	GT_SetVel(X:Double): SmallInt; stdcall;
function	GT_SmthStp: SmallInt; stdcall;
function	GT_StpMtn: SmallInt; stdcall;
function	GT_StrtList: SmallInt; stdcall;
function	GT_StrtMtn: SmallInt; stdcall;
function	GT_SynchPos: SmallInt; stdcall;
function	GT_TmrIntr: SmallInt; stdcall;
function	GT_Update: SmallInt; stdcall;
function	GT_ZeroPos: SmallInt; stdcall;

function        GT_SetBgCommandSet(Pcmdset:PBGCOMMANDSET;size:word):smallint;stdcall;
function        GT_GetBgCommandResult(Pcmdset:PBGCOMMANDSET;size:word):smallint;stdcall;
function        GT_SetIntSyncEvent(x:longword):smallint;stdcall;

{SG functions, for SG types of card }
{$ifndef GT_SP}
function        GT_StepPulse:smallint;stdcall;
function        GT_StepDir:smallint;stdcall;
{$endif}

{SD functions,for SD types of card }
{$ifdef GT_SD}
function	GT_SetTime(X:LongWord): SmallInt; stdcall;
{$endif}

{SV functions, for SV types of card }
{$ifdef GT_SV}
function	GT_AuStpOff: SmallInt; stdcall;
function	GT_AuStpOn: SmallInt; stdcall;
function	GT_CaptIndex: SmallInt; stdcall;
function	GT_EncSns(X:Word): SmallInt; stdcall;
function	GT_CloseLp: SmallInt; stdcall;
function	GT_OpenLp: SmallInt; stdcall;
function        GT_CtrlMode(X:SmallInt): SmallInt; stdcall;

function	GT_SetKaff(X:Word): SmallInt; stdcall;
function	GT_SetKd(X:Word): SmallInt; stdcall;
function	GT_SetKi(X:Word): SmallInt; stdcall;
function	GT_SetKp(X:Word): SmallInt; stdcall;
function	GT_SetKvff(X:Word): SmallInt; stdcall;
function	GT_SetMtrBias(X:SmallInt): SmallInt; stdcall;
function	GT_SetMtrCmd(X:SmallInt): SmallInt; stdcall;
function	GT_SetMtrLmt(X:Word): SmallInt; stdcall;
function	GT_SetPosErr(X:Word): SmallInt; stdcall;
function	GT_SetILmt(X:Word): SmallInt; stdcall;

function	GT_GetKaff(X:PWord): SmallInt; stdcall;
function	GT_GetKd(X:PWord): SmallInt; stdcall;
function	GT_GetKi(X:PWord): SmallInt; stdcall;
function	GT_GetKp(X:PWord): SmallInt; stdcall;
function	GT_GetKvff(X:PWord): SmallInt; stdcall;
function	GT_GetMtrBias(X:PSmallInt): SmallInt; stdcall;
function	GT_GetMtrCmd(X:PSmallInt): SmallInt; stdcall;
function	GT_GetMtrLmt(X:PWord): SmallInt; stdcall;
function	GT_GetPosErr(X:PWord): SmallInt; stdcall;
function	GT_GetILmt(X:PWord): SmallInt; stdcall;
function	GT_GetIntgr(X:PSmallInt): SmallInt; stdcall;
function	GT_GetAtlErr(X:PSmallInt): SmallInt; stdcall;
{$endif}

{SP functions, for SP types of card }
{$ifdef GT_SP}
function        GT_EncPos(id:smallint;x:Plongint):smallInt; stdcall;
function        GT_EncVel(id:smallint;x:Pdouble):smallInt; stdcall;
function        GT_GetAdc(id:smallint;x:Psmallint):smallInt; stdcall;
{$endif}

implementation

{general functions, for all types of card }
function	GT_AbptStp: SmallInt; External GTDLL;
function	GT_AddList: SmallInt; External GTDLL;
function	GT_ArcXY(x_center,y_center,angle:Double): SmallInt; External GTDLL;
function	GT_ArcXYP(x_end,y_end,r:Double;dir:SmallInt): SmallInt; External GTDLL;
function	GT_ArcYZ(y_center,z_center,angle:Double): SmallInt; External GTDLL;
function	GT_ArcYZP(y_end,z_end,r:Double;dir:SmallInt): SmallInt; External GTDLL;
function	GT_ArcZX(z_center,x_center,angle:Double): SmallInt; External GTDLL;
function	GT_ArcZXP(z_end,x_end,r:Double;dir:SmallInt): SmallInt; External GTDLL;
function	GT_AuUpdtOff: SmallInt; External GTDLL;
function	GT_AuUpdtOn: SmallInt; External GTDLL;
function	GT_Axis(X:Word): SmallInt; External GTDLL;
function	GT_AxisI: SmallInt; External GTDLL;
function	GT_AxisOff: SmallInt; External GTDLL;
function	GT_AxisOn: SmallInt; External GTDLL;
function	GT_BrkOff: SmallInt; External GTDLL;
function	GT_CaptHome: SmallInt; External GTDLL;
function	GT_Close: SmallInt; External GTDLL;
function	GT_ClrSts: SmallInt; External GTDLL;
function	GT_CrdAuStpOff: SmallInt; External GTDLL;
function	GT_CrdAuStpOn: SmallInt; External GTDLL;
function	GT_DrvRst: SmallInt; External GTDLL;
function	GT_EStpMtn: SmallInt; External GTDLL;
function        GT_EncPos(id:smallint;x:PLongInt):smallInt; External GTDLL;
function        GT_EncVel(id:smallint;x:PDouble):smallInt; External GTDLL;
function	GT_EndList: SmallInt; External GTDLL;
function	GT_EvntIntr: SmallInt; External GTDLL;
function	GT_ExInpt(X:PWord): SmallInt; External GTDLL;
function	GT_ExOpt(X:Word): SmallInt; External GTDLL;
function	GT_ExtBrk: SmallInt; External GTDLL;
function	GT_GetAcc(X:PDouble): SmallInt; External GTDLL;
function	GT_GetAccLmt(X:PDouble): SmallInt; External GTDLL;
function        GT_GetAdc(id:smallint;x:PSmallInt):smallInt; External GTDLL;
function	GT_GetAtlPos(X:PLongInt): SmallInt; External GTDLL;
function	GT_GetBrkCn(X:PLongInt): SmallInt; External GTDLL;
function	GT_GetBrkPnt(X:PDouble): SmallInt; External GTDLL;
function	GT_GetCapt(X:PLongInt): SmallInt; External GTDLL;
function	GT_GetCmdSts(X:PWord): SmallInt; External GTDLL;
function	GT_GetCrdSts(X:PWord): SmallInt; External GTDLL;
function	GT_GetIntr(X:PWord): SmallInt; External GTDLL;
function	GT_GetIntrMsk(X:PWord): SmallInt; External GTDLL;
function	GT_GetIntrTm(X:PWord): SmallInt; External GTDLL;
function	GT_GetJerk(X:PDouble): SmallInt; External GTDLL;
function	GT_GetLmtSwt(X:PWord): SmallInt; External GTDLL;
function	GT_GetMAcc(X:PDouble): SmallInt; External GTDLL;
function	GT_GetMode(X:PWord): SmallInt; External GTDLL;
function	GT_GetMtnNm(X:PWord): SmallInt; External GTDLL;
function	GT_GetPos(X:PLongInt): SmallInt; External GTDLL;
function	GT_GetPrfPnt(X:PDouble): SmallInt; External GTDLL;
function	GT_GetRatio(X:PDouble): SmallInt; External GTDLL;
function	GT_GetSmplTm(X:PDouble): SmallInt; External GTDLL;
function	GT_GetSts(X:PWord): SmallInt; External GTDLL;
function	GT_GetVel(X:PDouble): SmallInt; External GTDLL;
function	GT_HardRst: SmallInt; External GTDLL;
function	GT_LmtSns(X:Word): SmallInt; External GTDLL;
function	GT_LmtsOff: SmallInt; External GTDLL;
function	GT_LmtsOn: SmallInt; External GTDLL;
function	GT_LnXY(x,y:Double): SmallInt; External GTDLL;
function	GT_LnXYZ(x,y,z:Double): SmallInt; External GTDLL;
function	GT_LnXYZA(x,y,z,A:Double): SmallInt; External GTDLL;
function	GT_MapAxis(X:Word; y: PDouble): SmallInt; External GTDLL;
function	GT_MltiUpdt(X:Word): SmallInt; External GTDLL;
function	GT_MtnBrk: SmallInt; External GTDLL;
function	GT_MvXY(x,y,vel,accel:Double): SmallInt; External GTDLL;
function	GT_MvXYZ(x,y,z,vel,accel:Double): SmallInt; External GTDLL;
function	GT_MvXYZA(x,y,z,A,vel,accel:Double): SmallInt; External GTDLL;
function	GT_NegBrk: SmallInt; External GTDLL;
{$ifndef GT_ISA}
function	GT_Open(BasePort:LongWord;Irq:LongWord): SmallInt; External GTDLL;
{$else}
function	GT_Open(): SmallInt; External GTDLL;
function        GT_SwitchtoCardNo(x:word):smallint; External GTDLL;
function        GT_GetCurrentCardNo:smallint;External GTDLL;
{$endif}
function	GT_PosBrk: SmallInt; External GTDLL;
function	GT_PrflG(X:Word): SmallInt; External GTDLL;
function	GT_PrflS: SmallInt; External GTDLL;
function	GT_PrflT: SmallInt; External GTDLL;
function	GT_PrflV: SmallInt; External GTDLL;
function	GT_Reset: SmallInt; External GTDLL;
function	GT_RstIntr(X:Word): SmallInt; External GTDLL;
function	GT_RstSts(X:Word): SmallInt; External GTDLL;
function	GT_SetAcc(X:Double): SmallInt; External GTDLL;
function	GT_SetAccLmt(X:Double): SmallInt; External GTDLL;
function	GT_SetAtlPos(X:LongInt): SmallInt; External GTDLL;
function	GT_SetBrkCn(X:LongInt): SmallInt; External GTDLL;
function	GT_SetIntrMsk(X:Word): SmallInt; External GTDLL;
function	GT_SetIntrTm(X:Word): SmallInt; External GTDLL;
function	GT_SetJerk(X:Double): SmallInt; External GTDLL;
function	GT_SetMAcc(X:Double): SmallInt; External GTDLL;
function	GT_SetPos(X:LongInt): SmallInt; External GTDLL;
function	GT_SetRatio(X:Double): SmallInt; External GTDLL;
function	GT_SetSmplTm(X:Double): SmallInt; External GTDLL;
function	GT_SetSynAcc(X:Double): SmallInt; External GTDLL;
function	GT_SetSynVel(X:Double): SmallInt; External GTDLL;
function	GT_SetVel(X:Double): SmallInt; External GTDLL;
function	GT_SmthStp: SmallInt; External GTDLL;
function	GT_StpMtn: SmallInt; External GTDLL;
function	GT_StrtList: SmallInt; External GTDLL;
function	GT_StrtMtn: SmallInt; External GTDLL;
function	GT_SynchPos: SmallInt; External GTDLL;
function	GT_TmrIntr: SmallInt; External GTDLL;
function	GT_Update: SmallInt; External GTDLL;
function	GT_ZeroPos: SmallInt; External GTDLL;

function        GT_SetBgCommandSet(Pcmdset:PBGCOMMANDSET;size:word):smallint;External GTDLL;
function        GT_GetBgCommandResult(Pcmdset:PBGCOMMANDSET;size:word):smallint;External GTDLL;
function        GT_SetIntSyncEvent(x:longword):smallint;External GTDLL;

{SG functions, for SG types of card }
{$ifndef GT_SP}
function        GT_StepDir:smallint;External GTDLL;
function        GT_StepPulse:smallint;External GTDLL;
{$endif}

{$ifdef GT_SD}
{SD functions,for SD types of card }
function	GT_SetTime(X:LongWord): SmallInt; External GTDLL;
{$endif}

{SV functions, for SV types of card }
{$ifdef GT_SV}
function	GT_AuStpOff: SmallInt; External GTDLL;
function	GT_AuStpOn: SmallInt; External GTDLL;
function	GT_CaptIndex: SmallInt; External GTDLL;
function	GT_EncSns(X:Word): SmallInt; External GTDLL;
function	GT_CloseLp: SmallInt; External GTDLL;
function	GT_OpenLp: SmallInt; External GTDLL;
function        GT_CtrlMode(X:SmallInt): SmallInt; External GTDLL;
function	GT_SetKaff(X:Word): SmallInt; External GTDLL;
function	GT_SetKd(X:Word): SmallInt; External GTDLL;
function	GT_SetKi(X:Word): SmallInt; External GTDLL;
function	GT_SetKp(X:Word): SmallInt; External GTDLL;
function	GT_SetKvff(X:Word): SmallInt; External GTDLL;
function	GT_SetMtrBias(X:SmallInt): SmallInt; External GTDLL;
function	GT_SetMtrCmd(X:SmallInt): SmallInt; External GTDLL;
function	GT_SetMtrLmt(X:Word): SmallInt; External GTDLL;
function	GT_SetPosErr(X:Word): SmallInt; External GTDLL;
function	GT_SetILmt(X:Word): SmallInt; External GTDLL;

function	GT_GetKaff(X:PWord): SmallInt; External GTDLL;
function	GT_GetKd(X:PWord): SmallInt; External GTDLL;
function	GT_GetKi(X:PWord): SmallInt; External GTDLL;
function	GT_GetKp(X:PWord): SmallInt; External GTDLL;
function	GT_GetKvff(X:PWord): SmallInt; External GTDLL;
function	GT_GetMtrBias(X:PSmallInt): SmallInt; External GTDLL;
function	GT_GetMtrCmd(X:PSmallInt): SmallInt; External GTDLL;
function	GT_GetMtrLmt(X:PWord): SmallInt; External GTDLL;
function	GT_GetPosErr(X:PWord): SmallInt; External GTDLL;
function	GT_GetILmt(X:PWord): SmallInt; External GTDLL;
function	GT_GetIntgr(X:PSmallInt): SmallInt; External GTDLL;
function	GT_GetAtlErr(X:PSmallInt): SmallInt; External GTDLL;
{$endif}

{SP functions, for SP types of card }
{$ifdef GT_SP}
function        GT_EncPos;      External GTDLL
function        GT_EncVel;      External GTDLL
function        GT_GetAdc;      External GTDLL
{$endif}

{special command that Standard Card hasn't}
function get_actl_pnt(pnt: PInteger): SmallInt;
var r1,r2,r3,r4,r5,r6,r7,r8,r9,r10:smallint;
    temp:integer;
    s,k:word;
begin
    r1:=GT_GetSts(@S);  k:=((s shl 12)and $0003); inc(k);
    r2:=GT_Axis(1);
    r3:=GT_GetAtlPos(@temp);pnt^:=temp; inc(pnt);
    r4:=GT_Axis(2);
    r5:=GT_GetAtlPos(@temp);pnt^:=temp; inc(pnt);
    r6:=GT_Axis(3);
    r7:=GT_GetAtlPos(@temp);pnt^:=temp; inc(pnt);
    r8:=GT_Axis(4);
    r9:=GT_GetAtlPos(@temp);pnt^:=temp;
    r10:=GT_Axis(k);
    if (r1<>0)or(r2<>0)or(r3<>0)or(r4<>0)or(r5<>0)or(r6<>0)or(r7<>0)or(r8<>0)or(r9<>0)or(r10<>0)
          then  get_actl_pnt:=1 else get_actl_pnt:=0;
end;

end.
