Hello Guest it is March 28, 2024, 09:04:59 PM

Author Topic: Help Modifying RefAllHome  (Read 3792 times)

0 Members and 1 Guest are viewing this topic.

Re: Help Modifying RefAllHome
« Reply #10 on: March 14, 2018, 11:53:12 PM »
Hi,
kool. You only need home switches on the axes you wish to home, if your not worried about Z thats fine.

As youv'e probably already discovered to use the standard Ref All Home button that ships with Mach4 is intended
to home the Z axis in addition to X and Y. When Mach doesn't find a Z axis switch it will hang up and have a fit/meltdown.

Due to finish work in the next 15 min or so and hour plus drive home. Will post some pointers on what to do.
When you see hoe it works you will think to yourself 'Gee that was easy...why didn't I think of that'

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Help Modifying RefAllHome
« Reply #11 on: March 15, 2018, 01:41:09 AM »
Hi,
two ways to do this, simply or very simply....

This is the standard Ref All Home function in the screen load script, around line 200 depending on the build version and whether you've added any extra code preceeding
this.

Code: [Select]
function RefAllHome()
    mc.mcAxisDerefAll(inst)  --Just to turn off all ref leds
    mc.mcAxisHomeAll(inst)
    coroutine.yield() --yield coroutine so we can do the following after motion stops
    ----See ref all home button and plc script for coroutine.create and coroutine.resume
    wx.wxMessageBox('Referencing is complete')
end

Notice the API call  mc.mcAxisHomeAll(inst)
Just replace the Home All with homing individual axes:
mc.mcAxisHome(inst,mc.X_AXIS)
mc.mcAxisHome(inst,mc.Y_AXIS)
 
The code would now be:

Code: [Select]
function RefAllHome()
    mc.mcAxisDerefAll(inst)  --Just to turn off all ref leds
    --mc.mcAxisHomeAll(inst)
    mc.mcAxisHome(inst,mc.X_AXIS)
    mc.mcAxisHome(inst,mc.Y_AXIS)
    coroutine.yield() --yield coroutine so we can do the following after motion stops
    ----See ref all home button and plc script for coroutine.create and coroutine.resume
    wx.wxMessageBox('Referencing is complete')
end

Note rather than delete the original API call I commented it out ( put '--' in front of it ) so that if I want to revert back to standard I can do so easily.

That was the simple way but there is an even simpler way:
In the pic attached is the home order of my machine, Z axis first. If I assigned 0 to the Z axis home order it wouldn't be homed at all. Just assign 1 and 2 as
home order for X and Y axes and your done. No coding at all!
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Help Modifying RefAllHome
« Reply #12 on: March 15, 2018, 03:55:23 PM »
Wow, you're right, I can't believe I didn't think of just setting the home order for Z to 0, haha. Thanks for the help!
Re: Help Modifying RefAllHome
« Reply #13 on: March 16, 2018, 08:50:33 AM »
Ok, it looks like just changing the home order to 0 on Z didn't work. I need to edit the screen load script but I don't know how to do that. I can see it on the operator tab, but I don't know where the file is to actually edit it. I know this is a very basic question but I'm new to Mach4 and haven't needed to change much since I upgraded. Thanks
Re: Help Modifying RefAllHome
« Reply #14 on: March 16, 2018, 09:12:45 AM »
I figured out how to modify the screen load script. Changed the code to make it Ref X and Y individually, but now I'm getting this error code. I don't think any settings changed on X or Y since I had the RefAllHome working with all 3 axes. Thanks
Re: Help Modifying RefAllHome
« Reply #15 on: March 16, 2018, 04:28:56 PM »
Hi,
the reduced Ref All Home button works fine here, that is that only X and Y axes home.

Can you post a screen shot of the motor assignment page?

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Help Modifying RefAllHome
« Reply #16 on: March 16, 2018, 05:08:04 PM »
Hey I got everything working. Turns out I was getting signal interference on my USB cable. I moved it to a location away from everything else and haven't had any problems since. Thanks for the help, the programming changes worked perfectly. Thanks again!