-> Hier kostenlos registrieren
Hallo zusammen,
ich habe ein Problem mit dem Funktionsbaustein MC_CamIn. Koppeln, Achsen verfahren und Abkoppeln klappt schon mal. Das Problem ist, dass es lediglich ein mal klappt. Nach dem Aufruf von MC_CamOut wird die Slaveachse abgekoppelt und auch dementsprechend angezeigt, jedoch bleibt der Ausgang "InSync" von MC_CamIn auf True. Möchte ich nach einmaligem Koppeln und Abkoppeln wieder Koppeln klappt es dementsprechend nicht. Hat jemand einen Tipp für mich?
ich habe ein Problem mit dem Funktionsbaustein MC_CamIn. Koppeln, Achsen verfahren und Abkoppeln klappt schon mal. Das Problem ist, dass es lediglich ein mal klappt. Nach dem Aufruf von MC_CamOut wird die Slaveachse abgekoppelt und auch dementsprechend angezeigt, jedoch bleibt der Ausgang "InSync" von MC_CamIn auf True. Möchte ich nach einmaligem Koppeln und Abkoppeln wieder Koppeln klappt es dementsprechend nicht. Hat jemand einen Tipp für mich?
Code:
IF bReInitialize THEN
bDoCoupleBMotor:= FALSE;
bDoDecoupleBMotor:= FALSE;
nBMotorCoupleState:=0;
END_IF
fbDoCoupleBMotor(CLK:= bDoCoupleBMotor);
fbDoDecoupleBMotor(CLK:= bDoDecoupleBMotor);
fbBAxis();
fbBMotor();
IF fbDoCoupleBMotor.Q THEN
bDoCoupleBMotor:= FALSE;
nBMotorCoupleState := 1;
END_IF
IF fbDoDecoupleBMotor.Q THEN
bDoDecoupleBMotor:= FALSE;
nBMotorCoupleState := 7;
END_IF
CASE nBMotorCoupleState OF
1:
IF fbBAxis.bEnable AND fbBMotor.bEnable AND fbBAxis.bStatus AND fbBMotor.bStatus AND NOT fbBAxis.bMoves THEN
nBMotorCoupleState:=2;
END_IF
2:
IF fbBMotor.bMoves THEN
fbHaltBMotor(
Axis:= fbBMotor.AxisRef,
Execute:= TRUE,
BufferMode:= MC_Aborting);
nBMotorCoupleState:=3;
ELSE
nBMotorCoupleState:=4;
END_IF
3:
fbHaltBMotor(Axis:=fbBMotor.AxisRef);
IF NOT fbHaltBMotor.Busy THEN
fbHaltBMotor(
Axis:= fbBMotor.AxisRef,
Execute:= FALSE);
IF fbHaltBMotor.Error THEN
nLastWarning := fbHaltBMotor.ErrorID;
strErrorMessage := 'Error on Halt B Motor';
END_IF
nBMotorCoupleState := 4;
END_IF
4:
fbBMotor.lrVelocity := lrBMotorCoupleSpeed;
IF fbBMotor.M_MoveModulo(lrTargetPosition:= fbBAxis.AxisRef.NcToPlc.ModuloActPos, eDirection := MC_Positive_Direction) THEN
IF fbBMotor.iErrorID <> 0 THEN
nBMotorCoupleState := 9999;
nLastWarning := fbBMotor.iErrorID;
strErrorMessage:= '7:Error on Couple B Motor';
ELSE
nBMotorCoupleState := 5;
END_IF
END_IF
5:
IF NOT (fbBMotor.AxisRef.NcToPlc.CoupleState <>0) THEN
nBMotorCoupleState:=6;
ELSE
nBMotorCoupleState:=0;
END_IF
6:
fbBMotorCamIn( Master := fbBAxis.AxisRef,
Slave := fbBMotor.AxisRef,
CamTableID := 1,
MasterOffset := 0,
SlaveOffset := 0,
MasterScaling := 1.0,
SlaveScaling := 1.0,
StartMode := MC_STARTMODE_RELATIVE,
Execute := TRUE );
IF fbBMotorCamIn.InSync THEN
fbBMotorCamIn.Execute:=FALSE;
nBMotorCoupleState:=0;
ELSIF fbBMotorCamIn.Error OR fbBMotorCamIn.CommandAborted THEN
nBMotorCoupleState:=9999;
END_IF
7:
fbBMotorCamOut(Slave := fbBMotor.AxisRef,
Execute := TRUE);
IF fbBMotorCamOut.Done THEN
fbBMotorCamOut( Slave := fbBMotor.AxisRef,
Execute := FALSE);
IF fbBMotorCamOut.Error THEN
nLastWarning := fbBMotorCamOut.ErrorID;
strErrorMessage := 'Error on Deouple B Motor';
nBMotorCoupleState:=69;
ELSE
IF fbBMotor.bMoves THEN
nBMotorCoupleState:=8;
ELSE
nBMotorCoupleState:=10;
END_IF
END_IF
END_IF
8:
fbHaltBMotor(
Axis:= fbBMotor.AxisRef,
Execute:= TRUE,
BufferMode:= MC_Aborting);
nBMotorCoupleState:=9;
9:
fbHaltBMotor(Axis:=fbBMotor.AxisRef);
IF NOT fbHaltBMotor.Busy THEN
fbHaltBMotor(
Axis:= fbBMotor.AxisRef,
Execute:= FALSE);
nBMotorCoupleState:=0;
IF fbHaltBMotor.Error THEN
nLastWarning := fbHaltBMotor.ErrorID;
strErrorMessage := 'Error on Halt B Motor';
nBMotorCoupleState:=9999;
END_IF
END_IF
10:
nBMotorCoupleState:=0;
END_CASE