[ Back ]



You can cut-and-paste the section between the horizontal lines below into Notepad and save it as a ShopBot sbp file, but make sure to test it carefully before you trust it; I'm not sure if there will be any formatting changes. The program is set to trigger the input switch at Y = -.4", but that can be changed if you have a different setback on your contact bolt; the line to change is in red.




'yzero_v2.sbp -- Example file showing how to zero out y axis on contact switch

'Copyright 1998. ShopBot Tools, Inc.

'modified by Bill Young for Y-axis zeroing



'Initialize

SA,        'Let's be in Absolute Mode
SC,0        'In general, it is probably a good idea to turn off stack

       ' creation in a switch-oriented program like this in order

       ' to prevent unexpected effects related to the pre-processing

       ' of all movement commands. Alternatively SC,2 could be used

       ' to break stack activity into chunks.

SO, 0,1        'Activate switch sensitivity... NOT NEEDED from Ver2 because

       ' switches are ON unless explicity turned off with SO, 0,0

&Ycon = -0.40       'offset of contact to y-zero point

      ' change this value as needed

      'Set the contact switch action ... currently for input switch #1

ON INP(1,1) GOSUB CONTACT       'this is where we'll go on contact with switch

      'Make Y move to contact switch... the following line will display first and wait for key stroke

      ' *** Hit ENTER When ready to Zero ***

PAUSE       'Pause with no second value waits for key stroke and displays

      ' previous line, next blank comment line clears

      '
MY, -1       'start continuous negative Y move (just a big number)

      'Hope your switch is connected and tool & control box grounded,

      ' otherwize we'll wipe out your block!

      '

END       'This END statement causes the program to end here without

v' dropping through to subroutine

CONTACT:

      'This is our subroutine for action on hitting the contact switch

      'We hit the contact !

ON INP(1,1)       'First set switch to nothing to prevent secondary trigger

VA,,&Ycon       'Set the offset

PAUSE 1

JY,0       'Pull back to Y zero point

      'Now We're Back at the Pull-Up position and ready to work ...

PAUSE 2

RETURN       'Technically this RETURNs us to the next file line after the

      ' move that was interrupted by the switch ... eg. the MY

      ' and we will then encounter the END and leave the file.

      'This program could have been done with a GOTO CONTACT and the

      ' RETURN left out our replaced with an END ... we've shown

      ' the more general purpose GOSUB here.

      ' end of program