reset PLCStatusAxisEnabled PLCStatusAxisEnabled := FALSE; END_IF IF HLI3_CheckAxisValid(nHliAxisIdx) THEN IF nFirstSpindle = -1 AND gpAx[nHliAxisIdx]^.ipo_state.spindle_axis_r THEN (* store HLIIndex of first spindle *) nFirstSpindle := nHliAxisIdx; END_IF END_IF END_FOR // FB_CNCAxis Sample // CNC Axis Options // stOptions.strPathCompTable; // stOptions.bActivateCompTable; // stOptions.bReducedSpeed; // stOptions.bReducedSpeedZone1; // stOptions.bReducedSpeedZone2; // stOptions.bResetCalibration; // CNC Parameters // stParameter.bWriteParameter; // stParameter.nNumParameters := 2; // stParameter.strTempPath := 'C:\'; // stParameter.ParamList[0].strName := 'kenngr.swe_pos'; // stParameter.ParamList[0].strValue := '30000000'; // stParameter.ParamList[1].strName := 'kenngr.swe_neg'; // stParameter.ParamList[1].strValue := '0'; // PLCOpen // stPLCopen.nOverride; // stPLCopen.bExecuteHoming; // stPLCopen.bCamSignal; // stPLCopen.bExecuteMoveAbsolute; // stPLCopen.bExecuteReset; // stPLCopen.fPosition; // stPLCopen.fVelocity; // stPLCopen.fAcceleration; // stPLCopen.fJerk; (* fbAxis_X( nLogAxisNo:=1, bEnable:= PLCAxisEnable, bCalibrationCam:= bCalibrationCam, bSetRefOffset:= , fRefOffset:= , bFeedhold:= , stOptions:= stOptions, stParameter:= stParameter, stPLCopen:= stPLCopen, stStatus=> ); *) (* if there exits spindles use the first one for spindleoverride *) IF nFirstSpindle <> -1 THEN HLI3_SetAxisOverride(nHliAxisIdx:= nFirstSpindle , nOverride:= PLCSpindleOverride *10); fbHandleSpindleTechno( nHliAxisIdx:=nFirstSpindle , bIsChannelSpecific:= FALSE, bHandleGearChange := FALSE, nRevolution=> , nPosition=> , bError=> , nErrorId=> , M03:= M3, M04:= M4, M05:= M5, M19:= M19, M40 := M40, M41 := M41, M42 := M42, M43 := M43, M44 := M44, M45 := M45, ); (* acknowledge all spindle M funnctions immediately *) M3 := FALSE; M4 := FALSE; M5 := FALSE; M19 := FALSE; (* Example for starting and stopping a spindle in manual mode in first channel *) IF (CNCSystem.Channel[0].ActMode = HLI_IMCM_MANUAL_MODE) THEN fbMoveSpindle( nHliAxisIdx:=nFirstSpindle , nSpeed:= nSpindleRpm , (* defined in Global_HMI *) bStart:=bSpindleStart, (* defined in Global_HMI *) bStop:= bSpindleStop , (* defined in Global_HMI *) bBusy=> , bError=> , nErrID=> , sErrText=> ); END_IF IF (bSpindleStart AND NOT fbMoveSpindle.bBusy) THEN bSpindleStart := FALSE; END_IF IF (bSpindleStop AND NOT fbMoveSpindle.bBusy) THEN bSpindleStop := FALSE; END_IF END_IF (* Howto use plc controlled spindle : *) (* fbHandleSpindleTechnoPlcSp( nHliAxisIdx:= 0 , nHliChannelIdx:= 0 , bIsChannelSpecific:= TRUE, nLogAxisNoChannelSpecific:= 95 , bHandleGearChange:= FALSE , bChannelReset:= FALSE, nRevolution=> , nPosition=> , bError=> , nErrorId=> , M03:= SM3, M04:= SM4, M05:= SM5, M19:= SM19); *) ]]>