Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: kthomson on April 29, 2008, 11:00:22 PM

Title: Reset - I was wrong
Post by: kthomson on April 29, 2008, 11:00:22 PM
Ok, is there a way to stop the Reset lockout or not? I thought I had found a way around it by sending a reset code in a macro, but the way the code is parsed, even that seems to be impossible. What i am trying to do in this case is not important, the fact is that every time I try to write a macro that references a 'home' signal, regardless of axis, it locks up the machine until clicking on the 'Reset' button.

When it hits a 'X- or X+ limit/home' I want the machine to stop moving in that direction, when it hits a 'Y- or Y+ limit/home' I want it to stop moving in that direction, the same with 'Z'. I DO NOT want it to lock up the entire machine until I manually clcik on a 'Reset' button. There should be a way to stop the axis(s) from setting a lockout when hitting a limit/home switch.

Also, is there a source for syntax examples for the program commands? I have looked at every link available from this site, but it is like trying to look for 1000 needles in a  haystack. I can find a needle or two here or there, but there doesn't seem to be a list anywhere of available commands. I have taught myself three different programming languages, but with no documentation I can't teach myself this one.

Thanks
Ken
Title: Re: Reset - I was wrong
Post by: Chip on April 30, 2008, 01:32:54 AM
Hi, Ken

Put this code in your "reff all home" button, It's probably not what you want, Who Now's.

Limits are limits, I thought you wanted Homing, Homing is homing, It doesn't lock-up.

Try asking a question without telling us it's all do-do around hear.

DoButton( 24 )
While IsMoving()
Wend
Code "G01 Z-.5 f1"
While IsMoving()
Wend

DoButton( 23 )
While IsMoving()
Wend
Code "G01 Y.5 f1"
While IsMoving()
Wend

DoButton( 22 )
While IsMoving()
Wend
Code "G01 X.5 f1"
While IsMoving()
Wend

Have you looked at this http://www.artsoftcontrols.com/MachCustomizeWiki/index.php?title=Main_Page

Thanks, Chip

PS: I don't no any Language's
Title: Re: Reset - I was wrong
Post by: jimpinder on April 30, 2008, 02:55:17 AM
The switches you are using are multi-function. They are home switches and also limit switches.

If you use them as a limit switch - or access them whilst they are acting as a limit switch, they will, as you have found out, stop the whole system and require a reset.

If you access them as a homing switch, they do not cause the trip - they are programmed to take a hit, the axis reverses, the switch opens (or closes) again - BUT - THEY THEN BECOME LIMIT SWITCHES AGAIN - and as far as I understand - immediately.

What effect is it that you are trying to create - are you homing or what. I would not have thought it good practice to use LIMIT switches in a program as a positioning tool. I thought the idea was to use the homing facility and then use a G54 move to a position to start work.

As far as the syntax is concerned - see the post at the top of the main page by Hood - OEM codes
See also \Mach specific Subroutines-Functions grouped by purpose - MachCustomizeWiki.mht - which I think is attached to this forum
and also the attachment on the post "Re- Macros" where I attached VB Script commands.
Title: Re: Reset - I was wrong
Post by: Chaoticone on April 30, 2008, 05:59:16 AM
Ken, TRY SOFT LIMITS. I think if you do you'll save yourself a lot of grief.

Brett
Title: Re: Reset - I was wrong
Post by: sshneider on April 30, 2008, 10:18:31 AM
I'll be the first to admit that I'm not the 'sharpest tool in the shed' but, could you please explain what you mean by "Reset Lockout"?

I don't think ANYBODYs  machine goes into  reset when it hits a home switch.  All the home switch should do is reset your DROs to Zero.  If your machine goes into reset when you do a Ref all, something is wired wrong or something is configured wrong.  End of story here.

If your machine hits a limit switch it SHOULD go into reset.  It's the traditional industry standard use for a Limit switch.  Most dudes I know set their limit switches at the point just a tick before they run out of travel so it protects the machine from slamming into mechanical stops (not a pretty thing).  I don't want to sound Dorky but, it's what the whole concept of the limit swich was originally engineered for (in other words... don't bring a knife to a gun fight). 

If you want to employ some other kind of switch engaged stopping process, I would install an additional set of switches (of course requiring more inputs on your B.O.B.) and write machros to do what you want to do.  OR, forget about your existing limit switches functioning in the traditional sense by seperating them from your Home switch circuit and use them on a discrete input pin and write a macro to do what you want.  OR like Brett said, look at soft limits.

HTH,
Sid
Title: Re: Reset - I was wrong
Post by: Hood on April 30, 2008, 10:33:00 AM
I hate to say it but if your home switches have innacuracies when homing at a reasonable rate then you need better switches. Optical switches are cheap and extremely repeatable. Proximity switches have also been used to good effect and if you really insist on mechanical switches then good quality ones are  repeatable as well.
Hood
Title: Re: Reset - I was wrong
Post by: bowber on April 30, 2008, 10:45:50 AM
From what I understand your trying to get an accurate home position.

Well there are plenty of people that have done that using the normal Mach homing system, my own mill with micro switches is accurate to less than 0.001" and their just cheap ones from Maplins.
Try some optical switches, also read some of the previous posts about them, and I'm sure you'll get a reliable home position.

Re the reset button, I see no problem with how it works, you can in theory carry on past the limit if you hit the wrong arrow key, not good on an expensive machine, at least when you have to reset it reminds you to be careful.

Steve

I see Hood beat me to it  ;)
Title: Re: Reset - I was wrong
Post by: Chip on April 30, 2008, 12:59:35 PM
Hi, Ken

If you having problems with your sw's being unreliable/inconsistent, Set "De-Bounce Interval" to 1000 - 2000 in Config, General Configuration.

This delays Mach a little in seeing your sw's, Dampening/Insuring it's a valid sw opening/closing (Switches sometimes bounce a little).

Try the code above for your .5 in "re-position", Put this code in your "reff all home" Button, Operator, Edit Button Script, Click on "Ref All Home" Button.

Chip
Title: Re: Reset - I was wrong
Post by: kthomson on April 30, 2008, 07:39:54 PM
Sorry, my internet has been down for a while. As it turns out, there is nothing wrong with my code, and the limits aren't an issue. If I create a macro, and save it as a vbscript file, I can run it as many times as I want with no problem, but if I try to enter the script into the vbscript box on a button, it saves it ok, but when I try to run it from within Mach3 by clicking on the button I get a 'Compile Error' 'Invalid Syntax' or something like that.

I created a macro that will lower the Z axis until it touches my touchplate, then it retracts .252" (my plate is .498 thick), and sets the Z axis DRO to .750. It works EVERY time if I run it from the vbscript editing screen. I can copy the code and paste it into the vbscript box in Mach3Screen and save it, and when I look at the code in Mach3 it is identical. If I try to run it from the button I get a 'Compile Error' and it does nothing (except sometimes crash my computer).

I was initially using Screen4, but in that I haven't found any way to either change the code it is executing. Your choices are only to select what type of command, but for a vb script you can't tell it anything except to use a script edited in Mach3, and when you edit it there it won't save the new code. Every time you restart the code has reverted to what it has stored (sometimes, it will save it, I don't know why, but usually it doesn't)

I have also found that the While IsRunning(), Wend statement will lock my computer up completely (the only out is to pull the plug and restart) if it parses that line before the head starts moving. I had to put in a dummy argument to delay that line until the head had time to start moving.

Any ideas why it will run one way and not the other.
Title: Re: Reset - I was wrong
Post by: Chip on April 30, 2008, 09:10:35 PM
Hi, Ken

In the past there were some problems with edit button scripts being saved properly, Use the Config, "Save Settings" and give it a try.

What ver of Mach3 are you using, Under help, "About", Using ver R3.041 hear.

Hope this Helps, Chip
Title: Re: Reset - I was wrong
Post by: kthomson on April 30, 2008, 09:38:53 PM
I have tried both the current 'lockdown' version (I'm on a different computer from the one running Mach3 so I'm not sure of the version), and the newest beta release. The problem is the same on both. It doesn't seem to be so much a problem in how it saves it as how it runs it. I've done two different macros that run perfectly if i run them from the vbeditor screen, and they both crash if I run them from a button, even though the code is EXACTlY the same  on both screens. That defiinatly indicates that the problem is in Mach3 and not in the code. This could be a severe problem for me. I tend to customize my machines for what I'm doing with them, and this would indicate that I can't do it because it can't handle simple scripts. I switched to Mach3 because I was told how good it was, but this is a MAJOR deficiency.
Title: Re: Reset - I was wrong
Post by: sshneider on April 30, 2008, 09:54:05 PM
Have you tried this....

After you do your VB edit thing and save- try Reloading the screen set to refresh.  I have noticed that sometimes a screen set reload helps.

HTH,
Sid
Title: Re: Reset - I was wrong
Post by: Chaoticone on April 30, 2008, 10:16:45 PM
Also might want to try view, save current view after putting your code in the button.

Brett
Title: Re: Reset - I was wrong
Post by: kthomson on April 30, 2008, 10:25:53 PM
I have tried everything, including rebooting (which happens about every 2 min anyway). I have probably had to reboot my computer by pulling the plug at least 200 times in the past two days. If it gets caught in a 'While IsMoving(), Wend' loop (which happens frequently) I could only kill it by pulling the plug. The VB 'Stop' button doesn't work, you can't even do a 'Control/Alt/Delete' to kill the program, once it is stuck it is stuck. From what I can tell, Mach3 simply doesn't handle VB scrips worth a damn.

I used WinCNC for over 3 years on this machine, and it does have it's problems (no tech support, expensive, and no forums for problems), but when I wrote a macro, IT WORKED. I switched to CandCNC controllers and Mach3 because I was convinced by users on the CNCZone forum. They all said the same, 'Change to Mach3 and CandCNC', the support is great. I agree, the support is great, but that doesn't help if the software doesn't work. So far, I have spent over $500.00 on this conversion between hardware and software, and I'm getting less enthused by the day. I have spent countless hours over 3 days trying to do two simple macros, only to find that the software chokes on, what I know, is good code. I'll give this about 2 more days and I'll decide which program/controller to dump on ebay.
Title: Re: Reset - I was wrong
Post by: sshneider on April 30, 2008, 11:33:26 PM
Ken,

I think everyone has had their problems/frustrations at times and we feel your pain but when reading back through your posts (also on the other thread your started regarding the reset issue), I think everyone has tried quite sincerely to help you with your issues HOWEVER, You are asking Mach to do very specific customized tasks that really is not in the 'normal' scope of what most people do.  Of course this involves custom programming (VB and the like) but you have not shared your VB script or posted your screenset file for others to examine.  This makes it a little tough for others to see what it is that you are doing (or more specifically where the problems may lie). 

How about you post what it is that you are currently doing and maybe someone with some VB experience can help.

There are more than 2 ways to 'skin a cat'.  There are usually workarounds or 'alternative methods' to acheive the same results.  Perhaps a fresh perspective might help.  Again, as I've said already without showing us what you have done, it's hard for us to suggest any of these alternatives. 

Finally, like I said we feel your pain but might I offer as a kind and gentle word of advice...I think you will find that doggin' Mach on this forum probably won't get others 'inspired' to help out.
 :-\
Sid
Title: Re: Reset - I was wrong
Post by: Chip on May 01, 2008, 12:04:42 AM
Hi, Ken

The vb code I posted works fine hear loaded in the Ref All Button, No errors.

Chip

Title: Re: Reset - I was wrong
Post by: Brian Barker on May 01, 2008, 12:52:25 AM
Try adding a sleep to the While IsMoving()..

While IsMoving()
Sleep(100)
Wend

Thanks
Brian
Title: Re: Reset - I was wrong
Post by: jimpinder on May 01, 2008, 03:42:30 AM
Ken - I have been following this and appreciate your problems.

I run several macros on my machine - all interlinked to DRO's etc. I can put info in a DRO and the script reads and writes to them without a problem.

I do not bother with Screen4 - but write the program from the VB script editor on Mach (either Mill or Lathe).

When I have written these, I save them in the Macro file in the Mach folder, under the Code M(***)(three figure number) as per the instructions in the VB script editor. I can then either include them in a GCode program, or type M*** into the machine to execute immediately.

Can I suggest that you do this with your VB script and try that method. If the script is saved in the Macro file like this it should execute correctly.

If you then want to call the Macro on a button, there is only one line of script in the button window - calling the Macro number.

I am re-fitting my limits and homing switches with laser detectors this week, so, if you can post your script for us to have a look at, I don't mind putting it on my machine and seeing what happens. It sounds a useful piece of script anyway, and I could see with a User DRO or two thrown in, it could be used in all sorts of situations when setting up.
Title: Re: Reset - I was wrong
Post by: kthomson on May 01, 2008, 06:56:23 AM
Sorry about the 'rant'. I was just getting frustrated trying to get this to work.

One of the things I have had problems with is that the documentation seems to be spread out all over the place, and I don't guess I've found everything. Jimpinders suggestion will probably solve the problem, I've just never found the syntax to do that. At one time I did save the program as a 'M' file in the macros directory, but haven't seen a syntax example to call it from a button. I'm sure most of this is just a matter of me learning the languages involved and learning how to link them.

Thanks to everyone for their help and suggestions. I'll keep playing with it, I thing I'm getting close and I'll post the code when I get it working.