Hello Guest it is July 12, 2020, 04:51:32 PM

Author Topic: Mach4 Button OFFLINE  (Read 13443 times)

0 Members and 1 Guest are viewing this topic.

Re: Mach4 Button OFFLINE
« Reply #20 on: January 22, 2018, 03:15:30 AM »
Hi,
you can de-assert SI1 by disconnecting it or you can have Mach set it to zero.
These two little macros give you the chance to turn the servo enable signal on  and off and will help while your experimenting.

Code: [Select]
function m210()
local inst=mc.mcGetInstance()
local hsig,rc=mc.mcSignalGetHandle(inst,mc.OSIG_ENABLE0)
mc.mcSignalSetState(hsig,0)
end
if (mc.mcInEditor()==1) then
    m210()
end

Craig

Code: [Select]
function m211()
local inst=mc.mcGetInstance()
local hsig,rc=mc.mcSignalGetHandle(inst,mc.OSIG_ENABLE0)
mc.mcSignalSetState(hsig,1)
end
if (mc.mcInEditor()==1) then
    m211()
end
My wife left with my best friend...
     and I miss him!
Re: Mach4 Button OFFLINE
« Reply #21 on: January 22, 2018, 04:07:26 AM »
Hi,
yes, it's correct as you say. if I disable input, Mach4 executes, and engines are stopped.

When enabling drives, Mach4 and lathe axes are in two different positions.

I hypothesize solution:
it is possible to create a button in Mach4, which when pressed, memorizes DRO axes, and at the same time activates pin output  (to which I connect relay).

and at the release of this button, it will change the current DROs, with those stored previously, also deactivating output???.

if it were possible to create this button with these two functions, the problem would be solved!
Re: Mach4 Button OFFLINE
« Reply #22 on: January 22, 2018, 04:41:41 AM »
Hi,
yes that was what I was proposing from the very start.

You still need to experiment what happens when you re-enable the servo after jogging/MDIing. How it responds will determine the kind of code you need.

Start your machine, reference it and drive it to some reasonably central location. Disable one of the axes. Now jog away but ending some distance from where
you started. Re-enable the servo. What happens? Do the machine coordinates reflect its actual position or do they reflect the position when you disabled the
axis? Experiment with it so that you are 100% sure that you know how it behaves. Once you have that sorted generating some code to 'send it back' to where it was
should be pretty easy.

I don't think you'll need a relay or any other output.

The broad outline is:
1) When the 'offline' button is pressed the machine coordinates of the axes are remembered
2) The servos are disabled by sending the M0 and M1 enable outputs low
3) MDI/jog to your hearts content
4) When the 'offline' button is activated again
    a) Issue G53 G0 to the machine coords saved in step 1)
    b) Re-enable the servos by setting M0 and M1 enables high

Craig
My wife left with my best friend...
     and I miss him!
Re: Mach4 Button OFFLINE
« Reply #23 on: January 22, 2018, 07:52:51 AM »
I tried this sequence.

1- I made home aces.

2- moved Z axis halfway.

3- I physically disconnected wire in servo OFF.

4- moved Z axis through Jog (DRO of moving, but Z axis remains physically still).

5- connected wire in servo ON (motor active).

After the sequence 5, nothing happened.

Physical axis and DRO of Mach4 were in two different positions.

Re: Mach4 Button OFFLINE
« Reply #24 on: January 22, 2018, 02:39:13 PM »
Hi,
cool, that behaves as I expected and this should be pretty straight forward.

May I suggest using a macro like the one I posted yesterday to enable/ disable the servo rather than disconnecting
the wire. I suspect it will work the same but you will need to be able to do it with software. Try it out.

Craig
My wife left with my best friend...
     and I miss him!
Re: Mach4 Button OFFLINE
« Reply #25 on: January 22, 2018, 03:49:43 PM »
If you disable the drive after homing, the motor will fall back to a full step position. Therefore you have a position error. Would not recommend doing that.
Re: Mach4 Button OFFLINE
« Reply #26 on: January 22, 2018, 04:32:02 PM »
Hi,
then how would you recommend that you manually jog/MDI and Machs DROs keep track and yet have no motor movement?

Clearly there needs to be some code that re-aligns the controlled point in such a manner that the homing again makes
sense before the servos are re-enabled.

Craig
My wife left with my best friend...
     and I miss him!
Re: Mach4 Button OFFLINE
« Reply #27 on: January 23, 2018, 03:06:13 AM »
Hi,
today when I come back from work I try the macros.
can you explain their function to me? because I did not understand well.
do I insert them in the macros folder?
can I do from MDI? I called the macros M210 and M211.
Re: Mach4 Button OFFLINE
« Reply #28 on: January 23, 2018, 10:20:49 AM »
Hi,
then how would you recommend that you manually jog/MDI and Machs DROs keep track and yet have no motor movement?

Clearly there needs to be some code that re-aligns the controlled point in such a manner that the homing again makes
sense before the servos are re-enabled.

Craig

I don't have a better suggestions at the moment. Just wanted to point out that if you disable a stepper motor that is operated with microstepping, it will loose its position when disabled.

Martin
Re: Mach4 Button OFFLINE
« Reply #29 on: January 23, 2018, 02:51:59 PM »
Hi,
yes thats true, a stepper could potentially get out of sync by one half of a full step. Do the calculation, how
much is 1/2 step error on your machine?. If the error is large enough to be objectionable then you'll have
to re-reference OR not use OFFLINE, your choice.

Second, the OP is using servos, ie no microstepping.

Craig
My wife left with my best friend...
     and I miss him!