; Variable spindle warmup. !! ONLY CALL FROM warmUpSpindleCall program in MDI!! ; @BTI_LTD Betz Technik Industries Ltd. (USE AT YOUR OWN RISK!!) DEF INT _index = 1 ;step index DEF INT _currentRPM = 0 DEF INT _spindPause = 0 ; Set in calling program for temp stop above 1000 rpm ; this is because the controller needs to stop to switch from position to velocity mode DEF INT _rpmStepSize = 0 ; Set in calling program. RPM bump amount. default 500 DEF INT _rpmSteps = 0 ; See below DEF INT _stepInterval = 0 ; See below DEF INT _lastIndex = 0 DEF INT _flip = 0 DEF STRING[6] _motionCall ;not used currently DEF REAL _currentSeconds DEF REAL _currentTime= 0 ;minutes DEF INT _currentMinutes ; step of minutes conversion DEF REAL _currentMinutesTenths DEF REAL _lastTime= 0 ;seconds since last index change DEF REAL _startTime = 0 ;seconds since starting the warmup DEF INT _timeRemaining ; time remaining until warmup complete DEF INT _zSafe = 0 ; safe position for Z DEF INT _Xmax =0 DEF INT _Xmin =0 DEF INT _Ymax =0 DEF INT _Ymin =0 _Xmax = R7; X+ location _Xmin = R8; X- location _Ymax = R9; Y+ location _Ymin = R10; Y- location _spindPause = R4 ; Set in calling program for temp stop above 1000 rpm ; this is because the controller needs to stop to switch from ;position to velocity mode _rpmStepSize = R3 ; Set in calling program. RPM bump amount. default 500 _rpmSteps = (R2/_rpmStepSize) ; how many RPM steps. ex: 8000 rpm = 16 steps _stepInterval = ((R1*60) / _rpmSteps) ; how long to spend at each RPM level in seconds _zSafe = R12 ; Set in calling program for safe Z location _lastTime = 0 _startTime = $AC_CYCLE_TIME G64 ; contnuous path N04 IF ($P_TOOLNO == 0); MSG ("Spindle is empty, please reset and install a tool prior to running warm-up") M00 GOTOB N04; ENDIF N05 ;IF ($P_TOOLNO > 0) ; Dangerous to rotate certain tools fast MSG("CURRENT TOOL WILL ROTATE TO "< 3) GOTOF N100 IF (_spindPause <> 1) GOTOF N100 M05 G04 F3 ENDIF N100 S = (_index * _rpmStepSize) M03 _currentRPM = (_currentRPM + _rpmStepSize) _lastIndex = _index ENDIF N400 ; ; BED feedrate: N410 IF (_index <= (_rpmSteps / 2)) F = R5 GOTOF N430 ENDIF N420 IF (_index > (_rpmSteps / 2)) F = R6 ENDIF ; BED motion: N430 IF _flip == 0 SUPA X= _Xmin Y= _Ymin _flip = 1 ENDIF N440 IF _flip == 1 SUPA X= _Xmax Y = _Ymax _flip = 0 ENDIF IF (_currentSeconds > (_stepInterval * _rpmSteps)) AND (_index == _rpmSteps) GOTOF N999 IF (_currentSeconds < (_lastTime + _stepInterval)) GOTOB N10 IF (_currentSeconds > (_lastTime + _stepInterval)) _index = (_index + 1) _lastTime = _currentSeconds GOTOB N10 ENDIF N999 M5; Stop spindle MSG ("CAUTION CUTTING EDGE HAS BEEN SET TO ZERO!!!") M00 M30 ; ;