19
« on: June 08, 2008, 01:34:51 PM »
Hi Drew,
Your program has helped me a lot to learn about script with mach3. My turret has 8 positions, but no raise solenoid or index pins or BCD switches.
It is cycled one turret position by actuating a single air solenoid for about .55 seconds.
The turret is cycling fine by the following script in the file: M20.m1s located in the macros folder.
ActivateSignal(Output8) 'mapped to Port1 pin5, applies air to index cylinder
Code "G04 P.55"
While IsMoving()
Sleep 100
Wend
DeActivateSignal(Output8) 'turns off air to index solenoid which completes one index cycle.
So, any time I do M20 the turret advances and locks one position. Great so far.
Now, I need to come up with the number of cycles or moves needed to get to the desired next tool.
In the M6Start.m1s, I'd like to calculate the unsigned value of the (CurrentTool minus SelectedTool) which will give me the number of advances necessary to get to the next tool. Then I can call or execute M20 that number of times to get to the selected tool.
How would you do that? When you said M6 is not used in lathe but T0101, T0202,etc. did you mean that M06 does not appear in the G-Code program itself, but just the T-numbers and that MACH3 knows to look at the M6Start when it sees a T-number? (I noticed that you tested for M6)
Thank you for sharing your knowledge with newcomers to MACH.
BOB88