You have to enable the A axis in Ports and Pins and then in Motor Tuning set the number of steps per one turret index. Actually just a bit more than one index so that it overshoots a bit and then reverses to lock.
Here is a real quick one I made. Seems to work here in simulation.
numtools = 99 'The number of valid tools newtool = GetSelectedTool( ) 'read the new requested tool
currenttool = GetOEMDRO(1000) 'user DRO 1000 is used to store the current tool. In this line assign whatever is in this DRO to the variable While(currenttool< 1 Or currenttool > numtools) 'Check that currenttool contains a legal tool number. currenttool = question("Please enter the current tool") ' If not ask to enter the current tool in position. Wend SetOEMDRO 1000,newtool ' Set user DRO 1000 to the new tool number
dist = (newtool Mod 8 ) - (currenttool Mod 8 ) ' the number of turret positions to move to the requested tool.
If (dist < 0) Then 'Check if rollover needed dist = 8 - Abs(dist) End If
Code " G91 G0 A" & dist ' Move to the new turret position. While IsMoving() Wend Code " G91 G0 A" & (-dist/5) ' Reverse move to lock - set to 1/5th of one position and can be changed While IsMoving() Wend
Code "G90" ' Set back to absolute mode.
Set the A axis as above and although not mandatory check the rotational axis rollover in general config.
You can then use the proximity switch to home the A axis and set reset OEMDRO 1000.
Ok. Then you can use the switch for homing the turret. Since it's a stepper you will have to treat it as an axis and set it up in ports and pins and define the steps/per in motor tuning. For instance you could assign the A axis for the turret. Then you need to figure how many steps per one index of the turret the stepper has to make and enter this in the motor tuning. Once you know this you can write a simple macro to control the turret.
I suggest you doing a search on the forum for a macro and changing it to work for you. There are many here and I think you should be able to find something close to what you need. Anyway, see if you can find someting.