'' Header file created by ShopBot Header Writer '' '' ************************* Creation and Contact Info ************************* '' '' Zero X, Y, and Z at any corner of your material '' '' Created by Barry Rimmer on 2009-03-08, using the C2 and C3 routines '' provided by ShopBot as inspiration '' '' Use restrictions: no restrictions... free for any use '' '' For more information contact Barry Rimmer '' At k4mg@arrl.net '' '' ********** WARNING!!! ********** WARNING!!! *********** WARNING!!! ********** '' '' User takes responsibility for the effects and outcomes of the use of this program. '' Make sure you are satisfied that it is doing what you expect it to do. '' DO NOT PUT YOUR HAND UNDER THE Z CARRIAGE WHEN RUNNING PROGRAM! TOOL MUST BE OFF. '' '' Opening file info '' &jig_thickness = .088 'change to actual thickness of your zeroing jig '' ' End of header file 'Determine whether we are in Preview mode or Move/Cut mode &modenow = %(22) IF &modenow = 1 THEN GOSUB Changemode ' check if at zero point INPUT "If you need to move to your 0,0 position, type (Y) to open the Keypad. Move to the X,Y position, and lower Z to be inside the cap. When you are done positioning hit the ESC key to continue with the routine. Hit ANY other key to continue with the zeroing routine. Do not forget to touch tool to cup to be sure that the switch is activated!" &showpad IF &showpad = Y then GOSUB ShowKeypad 'Load the custom variables file from Custom Cut 90 C#,90 'Get Speed Limits IF %(25) = 0 THEN GOSUB GetInchSpeedLimits IF %(25) = 1 THEN GOSUB GetMetricSpeedLimits &SCALE = 1 IF &my_units <> %(25) THEN GOSUB Changeunits 'Read the starting speed values to reset later &start_XYmove_Speed = %(71) &start_XYjog_Speed = %(76) &start_Zmove_Speed = %(73) 'set up X and Y &XYapproach_Speed = &start_XYmove_Speed &XYtempJog_Speed = &start_XYjog_Speed If &XYapproach_Speed > &TopApproachSpeed then &XYapproach_Speed = &TopApproachSpeed If &XYtempJog_Speed > &TopJogSpeed then &XYtempJog_Speed = &TopJogSpeed VS, &XYapproach_Speed,,,,&XYtempJog_Speed '... and assign slower speeds 'set up Z &new_Zmove_Speed = .25 IF %(25) = 1 THEN &new_Zmove_Speed = 6 &zup = (&my_XYzeroSafeZ * &SCALE) 'Set thickness and pull-up distance &zbot = &jig_thickness * &SCALE &zup = &my_ZzeroSafeZ * &SCALE 'Save start X and Y positions for use with centering &start_X_pos = %(1) &start_Y_pos = %(2) 'Set paramaters SA 'Set tool to Absolute mode 'Limits are deactivated here, automatically reset to original state when file ends VN, 0 'Deactivate the limit switch functionality on input #3 SF, 0 'Deactivate software limits 'Start zeroing the X axis-------------------------------------------------------------- GOSUB TEST_CLEAR 'Check for clear 'First set the contact switch action ... ON INP(&my_ZzeroInput,1) GOSUB Xcontact 'this is where we'll go on contact with plate 'Then start the move in X (just a big negative number ... assumes we'll hit plate) MX, &first_move ' ... we return here after handling X homing 'Tool is now Zeroed in X , starting Y Zero routine. 'PAUSE 'Start zeroing the Y axis--------------------------------------------------------------- GOSUB TEST_CLEAR 'Check for clear 'First set the contact switch action ... ON INP(&my_ZzeroInput,1) GOSUB Ycontact 'this is where we'll go on contact with plate 'Then start the move in Y (just a big negative number ... assumes we'll hit plate) MY, &first_move ' ... we return here after handling Y homing ' ... and reset speeds VS, &start_XYmove_Speed,,,,&start_XYjog_Speed 'Tool is now Zeroed in X and Y Axis, starting Z Zero routine. 'PAUSE 'Start zeroing the Z axis---------------------------------------------------------------- GOSUB TEST_CLEAR 'Check for clear 'Set-up the contact switch action ... ON INP(&my_ZzeroInput,1) GOSUB Zcontact 'this is where we'll go on contact with plate VS, , &new_Zmove_Speed &little_plunge = %(3) - 2 IF %(25) = 1 THEN &little_plunge = %(3) - 50.8 MZ, &little_plunge 'Start continuous plunge ... looking for contact to occur 'If we don't contact anything for some reason we end up here ON INP(&my_ZzeroInput,1) 'Turn off switch check VS, ,&start_Zmove_Speed 'Reset Speeds because zeroing failed 'Zeroing Failed! PAUSE END 'This END statement causes the program to end here if no contact 'Subroutines For X Routine----------------------------------------------------------------- Xcontact: 'This is our subroutine for action on hitting the plate 'We hit the plate! ON INP(&my_ZzeroInput,1) 'Set switch to nothing to turn off &save_X_dist = %(1) PAUSE 1 MX, &start_X_pos 'Move back out for another pass ON INP(&my_ZzeroInput,1) GOTO Xagain MX, &second_move END Xagain: ON INP(&my_ZzeroInput,1) 'Set switch to nothing to turn off &X_center = (&save_X_dist + %(1))/2 PAUSE 1 MX, &X_center ZX PAUSE 1 RETURN 'This RETURNs us to the next main file line 'Subroutines For Y Routine----------------------------------------------------------------- Ycontact: 'This is our subroutine for action on hitting the plate 'We hit the plate! ON INP(&my_ZzeroInput,1) 'Set switch to nothing to turn off &save_Y_dist = %(2) PAUSE 1 MY, &start_Y_pos 'Move back out for another pass ON INP(&my_ZzeroInput,1) GOTO Yagain MY, &second_move END Yagain: ON INP(&my_ZzeroInput,1) 'Set switch to nothing to prevent secondary trigger &Y_center = (&save_Y_dist + %(2))/2 PAUSE 1 MY, &Y_center ZY PAUSE 1 RETURN 'This RETURNs us to the next main file line 'Subroutines for Z Routine---------------------------------------------------------------------------- Zcontact: 'This is our subroutine for action on hitting the plate VA,,, &zbot ,,,,,0 'Set final Z location and Zero Table Base Coordinate PAUSE 1 VS, ,&start_Zmove_Speed JZ, &zup 'Pull-up to safe height 'X, Y, and Z are now Zeroed! PAUSE END 'General Subroutines------------------------------------------------------------------------------------ Changemode: 'Tool will not do XY Zeoring in Preview Mode. Quit and change Move/Cut mode ... PAUSE END 'Exit program now Changeunits: 'You are using a different unit system (inches/millimeters) than you used when this program was set up. Do you want to change the settings? PAUSE IF %(25) = 1 THEN &SCALE = 25.4 IF %(25) = 0 THEN &SCALE = 0.03937 RETURN GetInchSpeedLimits: &TopApproachSpeed = .25 &TopJogSpeed = 3.5 &first_move = -2 &second_move = 2 RETURN GetMetricSpeedLimits: &TopApproachSpeed = 6 &TopJogSpeed = 88.9 &first_move = -50 &second_move = 50 RETURN ShowKeypad: SK RETURN TEST_CLEAR: &cleared = &my_ZzeroInput + 50 IF %(&cleared) = 1 THEN PAUSE 3 IF %(&cleared) = 1 THEN GOTO NO_CLEAR RETURN NO_CLEAR: 'Reset the orginal speeds VS, ,&start_Zmove_Speed VS, &start_XYmove_Speed,,,,&start_XYjog_Speed 'Contact did not clear for some reason. Exiting. PAUSE END