Commit a832c482 authored by Jörg Weingrill's avatar Jörg Weingrill
Browse files

cleaned comments; Buffer mode; added McHalt

parent 9a1cdecc
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4022.12"> <TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.0">
<POU Name="FB_Axis" Id="{18cf88d0-9c12-4f7c-90a6-943ec400ede8}" SpecialFunc="None"> <POU Name="FB_Axis" Id="{18cf88d0-9c12-4f7c-90a6-943ec400ede8}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_Axis <Declaration><![CDATA[FUNCTION_BLOCK FB_Axis
VAR_INPUT VAR_INPUT
///=============GROUP ADMINISTRATIVE============== // Enable Axis ("Achsfreigabe")
bPowerEnable: BOOL; bPowerEnable: BOOL;
// enable forward motion
bEnable_Positive: BOOL := TRUE; bEnable_Positive: BOOL := TRUE;
//enable backward motion
bEnable_Negative: BOOL := TRUE; bEnable_Negative: BOOL := TRUE;
//override controls
fPowerOverride: LREAL := 100; fPowerOverride: LREAL := 100;
// reset axis error
bReset: BOOL; bReset: BOOL;
///=============GROUP MOVE============== // execute axis movement
bMoveAbsExec: BOOL; bMoveAbsExec: BOOL;
// axis target position
fMoveAbsPos: LREAL; fMoveAbsPos: LREAL;
// axis velocity
fMoveAbsVelo: LREAL; fMoveAbsVelo: LREAL;
// lock axis with error
bStop: BOOL; bStop: BOOL;
// halt axis
bHalt: BOOL;
END_VAR END_VAR
VAR_OUTPUT VAR_OUTPUT
///=============GROUP ADMINISTRATIVE============== // power status of the axis
bPowerStatus: BOOL; bPowerStatus: BOOL;
// reset done
bResetDone: BOOL; bResetDone: BOOL;
///=============GROUP MOVE============== // axis has reached target
bMoveAbsDone: BOOL; bMoveAbsDone: BOOL;
// axis is busy moving
bMoveAbsBusy: BOOL; bMoveAbsBusy: BOOL;
// axis error on movement
bMoveAbsErr: BOOL; bMoveAbsErr: BOOL;
///=============GROUP STATUS============== // axis error
bAxError: BOOL; bAxError: BOOL;
// axis error id
nAxErrId: DWORD; nAxErrId: DWORD;
// current velocity
fActVelo: LREAL; fActVelo: LREAL;
// current position
fActPos: LREAL; fActPos: LREAL;
END_VAR END_VAR
VAR VAR
(*
Aufgabe
fbMcPower vom MC_Power anlegen;
fbMc_Reset vom Typ MC_Reset anlegen;
fbMoveAbsolute vom Typ MC_MoveAbsolute anlegen;
*)
// Baustein Reglerfreigabe // Baustein Reglerfreigabe
fbMcPower: MC_Power; fbMcPower: MC_Power;
...@@ -65,18 +73,10 @@ VAR ...@@ -65,18 +73,10 @@ VAR
(* MC_Stop *) (* MC_Stop *)
fbMcStop : MC_Stop; fbMcStop : MC_Stop;
st_fbMcStopOut: ST_McOutputs; st_fbMcStopOut: ST_McOutputs;
(*
fbMoveAbsolute1: MC_MoveAbsolute;
st_fbMoveAbsolute1Out: ST_McOutputs;
fbMoveAbsolute2: MC_MoveAbsolute;
st_fbMoveAbsolute2Out: ST_McOutputs;
fbMoveAbsolute3: MC_MoveAbsolute;
st_fbMoveAbsolute3Out: ST_McOutputs;
*)
nstate: INT; fbMcHalt: MC_Halt;
fb_RTrig1: R_TRIG; // nstate: INT;
// fb_RTrig1: R_TRIG;
MC_ReadActualPosition: MC_ReadActualPosition; MC_ReadActualPosition: MC_ReadActualPosition;
END_VAR END_VAR
...@@ -97,7 +97,6 @@ nAxErrId := stAxis.Status.ErrorID; ...@@ -97,7 +97,6 @@ nAxErrId := stAxis.Status.ErrorID;
fActVelo := stAxis.NcToPlc.ActVelo; fActVelo := stAxis.NcToPlc.ActVelo;
fActPos := stAxis.NcToPlc.ActPos; fActPos := stAxis.NcToPlc.ActPos;
(*============TO DO MC Power===============================*)
fbMcPower( fbMcPower(
Axis := stAxis, Axis := stAxis,
Enable := bPowerEnable, Enable := bPowerEnable,
...@@ -143,7 +142,7 @@ fbMoveAbsolute( ...@@ -143,7 +142,7 @@ fbMoveAbsolute(
Acceleration := 0, // 0 heisst default aus SystemManager "Dynamik" Acceleration := 0, // 0 heisst default aus SystemManager "Dynamik"
Deceleration := 0, Deceleration := 0,
Jerk := 0, Jerk := 0,
BufferMode := , BufferMode := MC_BlendingNext,
Options := , Options := ,
Done => StfbMcMoveAbsolut.Done, Done => StfbMcMoveAbsolut.Done,
Busy => StfbMcMoveAbsolut.Busy, Busy => StfbMcMoveAbsolut.Busy,
...@@ -174,10 +173,16 @@ fbMcStop( ...@@ -174,10 +173,16 @@ fbMcStop(
Error => st_fbMcStopOut.Error, Error => st_fbMcStopOut.Error,
ErrorID => st_fbMcStopOut.ErrorID ); ErrorID => st_fbMcStopOut.ErrorID );
]]></ST> fbMcHalt(
Axis := stAxis,
Execute := bHalt,
Deceleration := 0,
Jerk := 0,
BufferMode := MC_Aborting);]]></ST>
</Implementation> </Implementation>
<LineIds Name="FB_Axis"> <LineIds Name="FB_Axis">
<LineId Id="3" Count="14" /> <LineId Id="3" Count="9" />
<LineId Id="14" Count="3" />
<LineId Id="170" Count="1" /> <LineId Id="170" Count="1" />
<LineId Id="20" Count="10" /> <LineId Id="20" Count="10" />
<LineId Id="255" Count="0" /> <LineId Id="255" Count="0" />
...@@ -189,7 +194,10 @@ fbMcStop( ...@@ -189,7 +194,10 @@ fbMcStop(
<LineId Id="259" Count="0" /> <LineId Id="259" Count="0" />
<LineId Id="258" Count="0" /> <LineId Id="258" Count="0" />
<LineId Id="260" Count="0" /> <LineId Id="260" Count="0" />
<LineId Id="68" Count="18" /> <LineId Id="68" Count="17" />
<LineId Id="360" Count="0" />
<LineId Id="365" Count="0" />
<LineId Id="361" Count="3" />
</LineIds> </LineIds>
</POU> </POU>
</TcPlcObject> </TcPlcObject>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment