Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: olf20 on April 17, 2018, 08:22:43 PM

Title: Need Stop before running script
Post by: olf20 on April 17, 2018, 08:22:43 PM
I have a my probe homing script working and the only
thing I need to finish is;
For some reason the homing script will not
run until I hit stop, then reset.
I have noticed that on the MDI screen that I
can not enter a move until a stop, reset is
done also.
Am I missing something or just need to include
it in my program???
Thanks for any help!

olf20 / Bob
Title: Re: Need Stop before running script
Post by: TPS on April 18, 2018, 01:39:59 AM
sounds like a endless Loop in your code.
post your code and we will see.
Title: Re: Need Stop before running script
Post by: olf20 on April 18, 2018, 06:56:22 AM
I'll have to get it from the shop today.
This is only when I first start M3.
Once a stop / reset is hit everything
works.
Thanks
olf20 / Bob
Title: Re: Need Stop before running script
Post by: olf20 on April 18, 2018, 11:02:09 AM
Attached is the script.
Some of what in the script
was for Z height setting.
I have not cleaned it up yet.
Thanks again
olf20 / Bob



'Check oemdro# And oemled#

SetOEMDRO(800,0.5)
SetOEMDRO(801,0.5)
SetOEMDRO(802,2.0)

Sleep(100)

CurrentFeed = GetOemDRO(818)    'Get the current feedrate.
PlateThickness =1.250      'Set gauge thickness
ProbeFeed = 20         'Set feedrate during probing

Code "G90 F" &ProbeFeed      'Set to Absolute Distance mode

'X Axis Home

If GetOemLed (825)=0 Then   'Check LED to see probe is ready
Code "G4 P1"                   'Time to get to the X-plate
Code "G31X4 F" &ProbeFeed   'Start X probe routine
While IsMoving()      'Probe moving X axis
Sleep(100)
Wend            'End of move
Code "G4 P0.25"         'Pause
XProbePos = GetVar(2000)   'Get position of probe
Code "G0 X" &XProbePos
While IsMoving ()      'Axis moving
Wend            'End of move
Call SetDro (0, PlateThickness)   '?
SetOEMDRO(800,0)      'Set X DRO for correct direction
Code "G4 P0.5"          'Pause for Dro to update.
Code "G0 X-1.065"                 'Change the X retract distance here
Code "(X axis is now homed)"
'Code "F" &CurrentFeed      'Store current feedrate to F
Code "G54 P2"
End If

'Y Axis Home
Code "G90 F" &ProbeFeed      'Set to Absolute Distance mode

Sleep(1000)          'Sleep to finish X routine

If GetOemLed (825)=0 Then   'Check LED to see probe is ready
'Code "G4 P1"                    'Time to get to the  Y-plate
Code "G31Y4 F" &ProbeFeed   'Start Y probe routine
While IsMoving()      'Probe moving Y axis
Wend            'End of move   
Code "G4 P0.25"         'Pause   
YProbePos = GetVar(2001)   'Get position of probe
Code "G0 Y" &YProbePos
While IsMoving ()
Wend
Call SetDro (1, PlateThickness)
SetOEMDRO(801,0)
Code "G4 P0.5"          'Pause for Dro to update.
Code "G0 Y-6.820 F20"       'Change the Y retract distance here
Code "(Axis is now homed)"
'Code "F" &CurrentFeed      'Store current feedrate to F
Code "G54 P2"         'Pause to let code finish

Sleep(6000)         'Sleep to let program catchup
SetOEMDRO(800,8.8641)      'Set X work offset for Spoons
SetOEMDRO(802,2)      'Set Z work offset for All
SetOEMDRO(801,0.0000)      'Set Y work offset for Spoons

Else
Code "(Plate is grounded, check connection and try again)"
Exit Sub

End If

Code "X0 Y0"            'Ready to make spoons
Title: Re: Need Stop before running script
Post by: TPS on April 18, 2018, 11:35:21 AM
made some changes to your code, pls test

Code: [Select]
'Check oemdro# And oemled#

'Code"1003"

SetOEMDRO(800,0.5)
SetOEMDRO(801,0.5)
SetOEMDRO(802,2.0)

Sleep(100)

CurrentFeed = GetOemDRO(818) 'Get the current feedrate.
PlateThickness =1.250 'Set gauge thickness
ProbeFeed = 20 'Set feedrate during probing

Code "G90 F" &ProbeFeed 'Set to Absolute Distance mode

'X Axis Home

If GetOemLed (825)=0 Then 'Check LED to see probe is ready
Code "G4 P1"             'Time to get to the X-plate
Code "G31X4 F" &ProbeFeed 'Start X probe routine
While IsMoving() 'Probe moving X axis
Sleep(50)
Wend 'End of move
Code "G4 P0.25" 'Pause
XProbePos = GetVar(2000) 'Get position of probe
Code "G0 X" &XProbePos
While IsMoving () 'Axis moving
Sleep(50)
Wend 'End of move
SetOEMDRO(800,0) 'Set X DRO for correct direction
Sleep(100) 'Pause for Dro to update.
Code "G0 X-1.065"           'Change the X retract distance here
While IsMoving () 'Axis moving
Sleep(50)
Wend 'End of move
Code "(X axis is now homed)"
'Code "F" &CurrentFeed 'Store current feedrate to F
Else
Code "(Plate is grounded, check connection and try again)"
End If

'Y Axis Home
Code "G90 F" &ProbeFeed 'Set to Absolute Distance mode


If GetOemLed (825)=0 Then 'Check LED to see probe is ready
'Code "G4 P1"               'Time to get to the  Y-plate
Code "G31Y4 F" &ProbeFeed 'Start Y probe routine
While IsMoving() 'Probe moving Y axis
Sleep(50)
Wend 'End of move
Code "G4 P0.25" 'Pause
YProbePos = GetVar(2001) 'Get position of probe
Code "G0 Y" &YProbePos
While IsMoving ()
Sleep(50)
Wend
SetOEMDRO(801,0)
Sleep(100) 'Pause for Dro to update.
Code "G0 Y-6.820 F20" 'Change the Y retract distance here
While IsMoving () 'Axis moving
Sleep(50)
Wend 'End of move
Code "(Y axis is now homed)"
'Code "F" &CurrentFeed 'Store current feedrate to F

SetOEMDRO(800,8.8641) 'Set X work offset for Spoons
SetOEMDRO(802,2) 'Set Z work offset for All
SetOEMDRO(801,0.0000) 'Set Y work offset for Spoons

Else
Code "(Plate is grounded, check connection and try again)"
Exit Sub

End If

Code "X0 Y0"   'Ready to make spoons
While IsMoving () 'Axis moving
Sleep(50)
Wend 'End of move

Title: Re: Need Stop before running script
Post by: olf20 on April 18, 2018, 02:24:22 PM
Thanks for the reply.
I will try the code tomorrow.
My problem is not that the code does not work
right, it's that it will not run without
first hitting a stop, then reset, when
Mach3 is first started and only first started.
After that the code runs fine.
As I mentioned in my first post some
other functions will not work without
hitting a stop, reset.
Thanks again I really appreciate
your help!!
olf20 / Bob
Title: Re: Need Stop before running script
Post by: olf20 on April 19, 2018, 10:04:54 AM
Ran your changes today and the same thing happens.
Script will not run till I hit a stop first.
Hit Auto Z button and the dwell light
blinks for a second or two and then
nothing.
olf20 / Bob
Title: Re: Need Stop before running script
Post by: Tweakie.CNC on April 19, 2018, 10:29:47 AM
Hi Bob,

The problem may be Mach3 version specific. I had a similar issue back in 2012 which was only resolved by adding DoOEMButton(1003) towards the beginning of my code.

Tweakie.
Title: Re: Need Stop before running script
Post by: olf20 on April 19, 2018, 11:54:50 AM
I think you are right.
As I posted earlier I'm not able to
enter any MDI commands either.
Thanks for everyone's help!
olf20 / Bob
Title: Re: Need Stop before running script
Post by: olf20 on April 19, 2018, 05:41:31 PM
Adding the stop to the beginning of the script solved
the problem.
Thanks TPS for guiding me on proper script writing.
olf20 / Bob
Title: Re: Need Stop before running script
Post by: TPS on April 20, 2018, 02:43:59 AM
glad to hear that it is working now.

btw witch Version are you running, just to keep in mind.

Thank You
Title: Re: Need Stop before running script
Post by: olf20 on April 20, 2018, 06:33:33 AM
I'm running 062 because of ESS recommendation.
I have really had no trouble with it till this.
Oh well nothings perfect, and I learned something
more.
Thanks again for your help!
olf20 / Bob
Title: Re: Need Stop before running script
Post by: olf20 on May 25, 2018, 03:52:40 PM
Maybe related to this, or not.
Now my x and y limit switches will not work.
Z+ seems to work fine.
Nor will the Stop button on the screen.
I think this happened when I added the
probe led to the run screen.

All this is related to implementing the homing
probe.

I will have to get a fresh copy of the 1024 screen set
and load it and see if things go back to normal.

Anyone have anything like this happen??