unit vxdsupp;
{Unit zur Unterstützung des MPK3DRV.386 VxDs von Pascal aus}
interface
uses mpk3d;
type
PMotor=^TMotor;
TMotor=object
UnitUsed: Byte; {Aktuelle Motor-Nummer}
LastErr: Byte; {Fehler-Nummer zum Abfragen}
{ LowEnd, HighEnd: LongInt; {Grenzen}
{ Position: LongInt; {Momentane bzw. Zielposition}
constructor Init;
destructor Done;
function Assign(AUnit:Byte):Byte; {Motor in Beschlag nehmen, 1=X..3=Z}
function Unassign:Byte;
function Reffahrt(ToPos:LongInt):Byte;
function MoveAbs(ToPosition: LongInt):Byte;
function MoveRel(ByMoving: LongInt):Byte;
function SetMaxSA(NewSpeed, NewAccel: LongInt):Byte;
function SetTrans(Zaehler, Nenner: LongInt):Byte;
function GetPosition: LongInt;
end;
implementation
constructor TMotor.Init;
begin
end;
destructor TMotor.Done;
begin
end;
function TMotor.Assign(AUnit:Byte):Byte; {Motor in Beschlag nehmen, 1=X..3=Z}
begin
if EntryPoint<>nil then begin
LastErr:=VxdSupC(SM_Assign,AUnit,0,0);
if LastErr=0 then
UnitUsed:=AUnit;
Assign:=LastErr;
end;
end;
function TMotor.Unassign:Byte;
begin
if EntryPoint<>nil then begin
LastErr:=VxDSupC(SM_Stop,UnitUsed,0,0);
LastErr:=VxDSupC(SM_UnAssign,UnitUsed,0,0);
UnAssign:=LastErr;
end;
end;
function TMotor.Reffahrt(ToPos:LongInt):Byte;
begin
if EntryPoint<>nil then begin
LastErr:=VxDSupC(SM_Sync,UnitUsed,ToPos,0);
Reffahrt:=LastErr;
end;
end;
function TMotor.MoveAbs(ToPosition: LongInt):Byte;
begin
if EntryPoint<>nil then begin
LastErr:=VxDSupC(SM_MoveAbs,UnitUsed,ToPosition,0);
MoveAbs:=LastErr;
end;
end;
function TMotor.MoveRel(ByMoving: LongInt):Byte;
begin
if EntryPoint<>nil then begin
LastErr:=VxDSupC(SM_MoveRel,UnitUsed,ByMoving,0);
MoveRel:=LastErr;
end;
end;
function TMotor.SetMaxSA(NewSpeed,NewAccel: LongInt):Byte;
begin
if EntryPoint<>nil then begin
LastErr:=VxDSupC(SM_SetSA,UnitUsed,NewSpeed,NewAccel);
SetMaxSA:=LastErr;
end;
end;
function TMotor.SetTrans(Zaehler,Nenner: LongInt):Byte;
begin
if EntryPoint<>nil then begin
LastErr:=VxDSupC(SM_SetTrans,UnitUsed,Zaehler,Nenner);
SetTrans:=LastErr;
end;
end;
function TMotor.GetPosition:LongInt;
var
P,S: LongInt;
begin
if EntryPoint<>nil then begin
LastErr:=VxDSupV(SM_GetPosition,UnitUsed,P,S);
GetPosition:=P;
end;
end;
end.
Detected encoding: OEM (CP437) | 1
|
|