Machsupport Forum
		Mach Discussion => VB and the development of wizards => Topic started by: rufan on July 16, 2013, 04:10:03 AM
		
			
			- 
				I have written a macro to Dynamic Brake my Mill spindle to perform tool change.
 The macro is working, but in my opinion it is not the most nice solution.
 Spindle motor = 4kw DC motor with Lenze 480 controller.
 Rotation Direction is performed by 2 relays.
 
 Please check the macro, if there is a better approach please let me know.
 You will wonder why I used the code instead of dospinCW(), this is because macro M3, M4 & M5 are also edited.
 
 Sample M3 macro:
 DoSpinCW()
 ActivateSignal(OUTPUT6)      'Activate the motor controller.
 
 
 -----------------------Dynamic Braking Macro---------------------------------------------
 code "M5"                   'Stop spindle
 sleep 100
 code "M4S10"              'Turn spindle CCW
 sleep 2000                  'Time to brake from 6000rpm
 code "M3S10"          'Turn spindel CW to brake if the overshoot
 sleep 100
 code "M4S10"          'Turn spindel CCW to brake if the overshoot
 sleep 200
 
 While Not isactive(INDEX)
 sleep 1
 ActivateSignal(OUTPUT9)      'Activate the locking pin
 If isactive(INDEX) Then code"M5"
 Wend
 
 While GetOEMDro(39) >0      'Get actual spindle speed
 sleep 1
 Wend
 
 While Not isactive(INDEX) And Not isactive(OEMTRIG1)   'To make sure spindle is aligned
 sleep 10
 Wend
 'Continue Tool Change Macro
 
 Thanks in advance.
 
 
 
- 
				You may want to check the manual for that controller it may NOT like being thrown into reverse at full forward speed. It could blow the final out of it IF it was not designed to do so.
 
 Just a thought, (;-) TP