Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: MaBoeck on January 03, 2017, 04:26:01 AM

Title: Configuration of Mach4 for homing with reference contacts
Post by: MaBoeck on January 03, 2017, 04:26:01 AM
Hello,

I’m from Brunswick (Germany) and I’m a very new user of Mach4. I have used Mach3 with Windows XP via parallel ports in the past.
Now I want to try Mach4 on Windows 10 via SmoothStepper.

I have configured Win 10 to be a very “speechless” system and the communication with the SmoothStepper works well.
I want to control a portal milling machine with 3 axes.
X & Y has got to limit switches and one reference contact in the middle.
Z has got just one limit switch (top) and one reference contact.

All limits are combined together to one output by my controller. That signal I have configured as just one input (‘A ++’) on the ESS.
The reference contacts of each ax are configured as individual input’s (‘X Home / Y Home / Z Home’) on the ESS.

With Mach3 it was possible to make the homing on that way that the machine was running first to the reference contacts (in the middle of each ax) and than a configured distance to the homing position.
I know that therefore a macro must be used in Mach4 (e.g. based on the description of DazTheGas) but I’m not able to do so.
First of all the home signal is coming (on ‘Machine Diagnostics Screen’) whenever I trip a contact.
But the status LED-field (next to the position field) is not changing to green. ???

Hope someone can help me to configure Mach4 to go forward!
Title: Upadte: Configuration of Mach4 for homing with reference contacts
Post by: MaBoeck on January 05, 2017, 03:21:54 AM
Hi,

Meanwhile I have found the problem. I have made some mistakes in the configuration of the ESS.
The ‘Reference All Axes’ of Mach4 is working now like it should.

But it looks like that the version of Mach4 (or the wx4.set) I have installed is different to the one which is used by DazTheGas in his video.
1.   After ‘Reference All Axes’ the machine is moved to the reference positions and the exact OffSet values from the configuration of the ‘Homing’ are shown. (Pic. 01)
2.   I have debugged the code and figured out that the problem starts within the ‘Signal Script’. The variable ‘sig’ is not set and based on that the ‘if (sig == …)’ can’t work. (Pic. 03)
3.   In the ‘Screen Load Script’ is now a function ‘RefAllHome’ (Pic. 04) which is called by all ‘Reference All Axes’ buttons (Pic. 05)

I guess with this version of the wx4.set just a GCode must be run right before the ‘Referencing is complete’ message box is called. The GCode must move the machine to coordinates ‘all zero’. But I’m a very inexperienced user of Mach4 and I would like to have a solution which is based on the knowledge of the experienced users here!

Title: Re: Configuration of Mach4 for homing with reference contacts
Post by: SinteredFuzz on May 09, 2017, 08:00:24 PM
Wow. Nothing for comments here??? Being new I had hoped to find a solution to the offset issue that still plagues Mach4.
Title: Re: Configuration of Mach4 for homing with reference contacts
Post by: joeaverage on May 09, 2017, 09:10:41 PM
Hi,
not sure that I understand exactly what you want to achieve.

My understanding of Mach4 Homing functions in this manner:
1)Ref All instruction
     [Turns off Homed LEDs, initiates movement on each axis according to homing order, direction and speed per user applied
       settings]
2)Home switch activation
     [Stops axis motion, reverses direction and backs off the switch until activation, set axis machine zero, apply user defined offset
       to axis DRO]
3) Home remaining axes in order
4) Turn on Axis Homed LEDs
       [Issues 'Referencing Complete' notice]

The important point is that each axis has a machine co-ord zero reference at the location where its Home switch reactivates. The offset
is applied to the DRO relative to that zero. Your post suggests that you wish to nominate a different location as machine zero. I don't
believe 'offset' will do that for you.

I can see a way around it tho.
If you drive your machine to the home location with the Ref All button per normal, then MDI to the desired machine zero, presumably one
corner of your travel envelop, then 'machine zero in place' This could be achieved by adding suitable code to your Ref All button.

Craig
Title: Re: Configuration of Mach4 for homing with reference contacts
Post by: SinteredFuzz on May 10, 2017, 06:57:50 AM
 Thank you for the tip off. I am using the ESS and have read that the offsets don't work. They don't seem to work on my set up.  But if I can add to the ref all button to solve this, that would be great. Currently, every time I go to move from home after doing a ref all my machine limits out  and I have to keep diddling with it to get going. I will search for a thread that explains how to add suitable code to my roof all button. 
Title: Re: Configuration of Mach4 for homing with reference contacts
Post by: joeaverage on May 11, 2017, 07:42:22 PM
Hi,
its not so much that offsets don't work but rather they're totally different to what you want.

Trying to find a 'home in place' instruction, if you are familiar with Mach3 it was an optional facility you could use to reference your machine.
I can't find a direct equivalent in Mach4. Mach4 Core does have a 'home in place' flag but the expectation is that the motion plugin actually does
the work. I use an ESS and I cannot see that 'home in place' is implemented.

I've yet to try... but from Mach4 API I found:
rc = mc.mcAxisHomeComplete(
      number mInst,
      number axisId);
which may do as you require. I will experiment some and report back.

Craig
Title: Re: Configuration of Mach4 for homing with reference contacts
Post by: Chaoticone on May 12, 2017, 12:53:17 PM
Home in Place works fine here in Mach4 with the ESS.

Title: Re: Configuration of Mach4 for homing with reference contacts
Post by: joeaverage on May 13, 2017, 02:49:07 AM
Hi,
what build ESS plugin, I have 186 installed but it doesn't have home in place.

Craig
Title: Re: Configuration of Mach4 for homing with reference contacts
Post by: DazTheGas on May 13, 2017, 03:47:58 AM
At the moment the current release of the plugin is build 202, the "Home In Place" is not located in the ESS Config, it can be found in the Mach4 Config under the Homing tab.

DazTheGas
Title: Re: Configuration of Mach4 for homing with reference contacts
Post by: joeaverage on May 13, 2017, 06:05:22 PM
Hi Daz,
don't know how I missed it...

Still not sure that its going to help. My original suggestion to the original poster was to home to the centrally
located home switches using 'reff all' per normal, MDI to a more sensible machine zero and 'home in place' at that
location.

It rather looks like the 'home in place' option in Mach allows one or t'other method.

Craig
Title: Re: Configuration of Mach4 for homing with reference contacts
Post by: joeaverage on May 14, 2017, 12:21:30 AM
Hi MaBoeck,
I have been experimenting at my machine and believe I've got a workable solution.

Mach4 core has a container for the 'home in place' flag. With the container variable false when the 'ref<axis>' or 'ref all' button
is pressed the machine will home to the switches in the order, direction and speed you specify as normal. The motion plugin/controller
actually does the work.

If however the 'home in place' flag is true for a given axis it will not drive anywhere but reset its machine co-ord to zero and home
in its current location.

Machs API has some instructions you can use to manipulate the 'home in place' flag programmatically.
The first is:
Quote
homeInPlace, rc = mc.mcAxisGetHomeInPlace(
      number mInst,
      number axisId)
which allows you to inspect the status of the flag for a given axis and:
Quote
rc = mc.mcAxisSetHomeInPlace(
      number mInst,
      number axisId,
      number homeInPlace)

which allows you to set the flag as you require. Presumably the flag will eventually be written to your profile and would become permanent
if you left it.
My suggestion for the 'ref all' button script would be:

1) Ref All---drive to home switches per normal
2)MDI---or programmed move to your desired machine home...something like
       mc.mcCntlGcodeExecuteWait(inst,'G53 G0 x500 y500 z-100')   this will hopefully put you at your desired machine home
3)mc.mcAxisSetHomeInPlace(inst,0,1)---sets 'home in place' flag for X axis as true
4) RefX--- given the 'home in place' flag the current X axis location will become X 0.
5)mc.mc.SetHomeInPlace(inst,0,0)---sets x axis 'home in place' flag back to normal
6) Repeat for Y and Zaxes as required.

Craig