hi,
lets review what we have got, what we need to do yet and some ultimate goal.
We have a macro (m180) that can lock the turret. It still needs to be tested on your hardware.
We have a macro (m185) that advances the turret one position and then locks it place and advances a counter to indicate the new position. Again this needs
to be tested on your hardware.
What remains to be done is have a procedure made up of these two operations that can advance until the Index switch is detected. Mach can then reset its
tool position counter and be assured for the rest of the session it will stay in sync with the tool.
Another useful procedure would be to have a function that advanced two positions, or three positions or more. Thus if the current tool is no.2 and
tool no. 4 is required use the 'advance by two' function.
Why might you ask that I am adding all these functions? Am I not complicating matters.....and the answer is yes...to a certain extent.
My ultimate strategy is to have a table of functions called Turret[].
It will have a function called Lock.
It will also have a function called Advance.
It will have a function called Index.
It will have a function Advance2.
It will have a function Advance3.
and so on.... You can see where this is going. My hope is that Index your machine at startup you will call Turret.Index That's it! You need do no more.
To go from your current position to two positions further you call Turret.Advance2 That's it! You need do no more.
Code like that is best as a module....but we will come to that later.
First trick is to make some code that works...there is still a little to go yet. The next thing is to refine the code so that its efficient and robust. THEN if all
is well stick it all in a multifunction table.
Provided we can get code to work you could bail before doing all the table/module stuff, I won't drag you down that rathole unless you want to!
Craig