Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: Monty12345 on December 07, 2020, 09:59:14 AM

Title: Updating Mach3 broke my macro...now what??
Post by: Monty12345 on December 07, 2020, 09:59:14 AM
I have an EMCOTurn140 running mach3. Everything was working fine, except for threading. While trying to sort that out, I discovered that many improvements have been made in threading in subsequent versions of Mach. Of course that was the first thing I thought to try.

I saved my .XML file, macros etc, and ran the installer. When I got Mach up and running again, I noticed a few issues.

The Home X and Home Y button no longer work....strange. :-\ I found that I can use the set X home set Y home buttons to accomplish the same thing, weird, but I can deal with it.

The real problem is my tool change macro no longer works. I get the dreaded Cypress Enable internal error message. The macro is in the correct folder and executes partially. I know it gets to the go home command. The message I get says internal error on line 164. This is the beginning of a for next loop. None of the commands between the go home command and line 164 execute. This macro used to work flawlessly.   >:( >:(

Anybody have an idea where I should look to resolve this issue?
Title: Re: Updating Mach3 broke my macro...now what??
Post by: Graham Waterworth on December 07, 2020, 10:21:57 AM
Load the macro into the Mach3 editor and single step it through to find the error.

You may need to pre set the tool numbers in the code for it to work.
Title: Re: Updating Mach3 broke my macro...now what??
Post by: Monty12345 on December 07, 2020, 12:27:51 PM
When I use the VB editor and step through it works.

If I try to enter a tool in the command line it goes into a doom loop and Mach takes up all the CPU resources. I can hit the reset button and get out of it. The turret never moves.

I am going to re-write this and try to use set feed rate instead of DO OEM button calls....that was kind of clunky...

Has something changed about tool selection? I used to just enter T0101 and tool 1 offset 1 would be selected.
Title: Re: Updating Mach3 broke my macro...now what??
Post by: Monty12345 on December 07, 2020, 01:41:55 PM
Very strange. I got rid of the loops and DoOEMButton commands to change jog rate. Instead I used SetOEMDRO (3, X) This seems to work. If I enter the tool number the jog DRO cycles through fast and slow, but the Jog commands are ignored, and then the doom loop happens. I Can't determine where that is, since when I step through it all works!  ???
Title: Re: Updating Mach3 broke my macro...now what??
Post by: Monty12345 on December 07, 2020, 02:10:53 PM
I am unable to manually jog using continuous mode and the keyboard when in the diagnostics screen. This makes it hard to check my inputs and outputs. It appears that the jog functions are getting disabled somehow. Since that is how I move the turret I think the macro gets stuck in a loop waiting for movement that never happens. Is there some new feature in Mach that disables keyboard/cont. jogging unless being commanded in the manual screen?
Title: Re: Updating Mach3 broke my macro...now what??
Post by: TPS on December 07, 2020, 03:40:26 PM
don't use all this jog stuf in the macro anyway, use incremantal moves.

a Code "G91 G1 Y(+- *********) F10" will do better Job like all this Manual jog and Stop things.

don't Forget to Switch Back with Code "G90"
Title: Re: Updating Mach3 broke my macro...now what??
Post by: Monty12345 on December 07, 2020, 03:44:14 PM
Can I still use event driven commands with the G code?

This turret has a bunch of interlocks that need to be looked at. Originally it used an AC servo and just turned one way until the condition was met. I converted to stepper.

That's why I used jog instead of distance.

Title: Re: Updating Mach3 broke my macro...now what??
Post by: TPS on December 07, 2020, 03:50:29 PM
you can set up your stepper (Motor tunnig step/per) that you get with a G91 Y360 Fxx one full rev.
the rest i simple calulation ?


ypu can use G-Gode commands in a macro as well:

Code: [Select]
Code "G91 G1 Y********* F*********"
is the same like in MDI or G-Code file
Title: Re: Updating Mach3 broke my macro...now what??
Post by: TPS on December 07, 2020, 03:59:13 PM
if you stepper is tuned to 360 is 1 rev,
you know 1 Station shift is 45 geg

you know for example 3 station's to go postive

code will be:
Code: [Select]
Code "G91 G01 Y"& staionstogo*45 & " F100"
Code "G90"
While IsMoving()
Wend

for nagative:
code will be:
Code: [Select]
Code "G91 G01 Y-"& staionstogo*45 & " F100"
Code "G90"
While IsMoving()
Wend
Title: Re: Updating Mach3 broke my macro...now what??
Post by: Monty12345 on December 07, 2020, 04:01:06 PM
I get it, but the problem is the way the turret locks and unlocks. Depending on which position, tools etc, it might require more or less reverse rotation to lock the turret. The motor needs to move until  the strobe indicates proper postition, then the lock solenoid is engaged and the turret reverses until the lock prox switch is in the correct state, and then the solenoid is disengaged. If these things don't happen, the turret will not lock properly, or it will not turn for the next tool change. It needs to be event driven, not just a distance moved.

And.....of course I'd rather be making chips that writing a new macro!  ;)
Title: Re: Updating Mach3 broke my macro...now what??
Post by: Monty12345 on December 07, 2020, 08:19:03 PM
I have it working with G91. Unfortunately it's all coming back to me now. There is a reason I did it using jog buttons. The distances the motor has to turn change depending on if it's reversing direction or not. The load isn't equal either, and sometimes it loses steps. To make it repeatable i have to slam it into the index pin. Which isn't kind to things and doesn't sound very nice while the stepper is stalled. The only alternative is to go REALLY slow which makes tool changes annoying.

Is there a way to interrupt a G code command? If I could do that, I could really speed things up and avoid all the banging around. Maybe have an M00 in there after the conditions are met ???

Title: Re: Updating Mach3 broke my macro...now what??
Post by: Monty12345 on December 07, 2020, 10:28:41 PM
M00 was the ticket. Everything is event driven now, with large enough margins on the incremental moves that it works repeatably. The good news is I was able to increase the speed significantly. The limiting factor is how fast the parallel port can read the strobe pulses and activate the lock solenoid. If I go too fast it misses the strobe....still a lot faster than before. I'll post the code tomorrow after I clean up the comments.

Now if the threading will just work!