Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: 1hxo on April 23, 2013, 04:53:23 PM

Title: reference Script
Post by: 1hxo on April 23, 2013, 04:53:23 PM
Hello
I have a big Problem with the script for my reference script.
When i push the button ref all home my Z axes run to the switch,touch the switch and release the switch.The same for X and Y.
But when the axes touch the switch mach3 zero the machine coords DRO then my machine release the switch and the DRO goes on and stop at about +0,0400 to +0,0100 the Leds dont turn green.
It is possible to zero the machine coords DRO with a script like the work DRO?
When i use setoemdro(800,0) the work DRO will reset to zero
Somebody knows the Command for Zero the machine coords DRO?

My controll board is the Pokeys 56U
All switches are activate and they are function.
The only thing is i want to reset the Machine coords after a Ref All Home call

Title: Re: reference Script
Post by: 1hxo on April 23, 2013, 05:40:14 PM
Ok And a other problem with the vb scripting:
When i use the mach3 vb script editor and then enter:

DoButton( 22 )
While IsMoving()
Wend
Code "G53 G0 X0"

And now when i hit the button run the machine drives to ref x and then he should go in machine coords and g0 to x0?
instead the vb script editor hangs untill i push the reset button twice then the vb script drives the x axes in g53 to x0
Is this normal?
Title: Re: reference Script
Post by: 1hxo on April 23, 2013, 07:23:47 PM
Now i have try several scripts
When i use:

code"g0 x30"
while ismoving()
wend
code"g53 g0 x0"

Then the script runs fine.
as soon as i use at first command a dobutton(22) then the scripteditor hangs untill i press reset button.
The same when i use G28 command
When i first use a dobutton(22) then press stop then can i use a code"g53 go xo"
Have someone an idea where i have a mistake?
Title: Re: reference Script
Post by: Hood on April 24, 2013, 03:00:02 AM
What revision of Mach are you using?
Hood
Title: Re: reference Script
Post by: 1hxo on April 24, 2013, 03:06:03 AM
I use mach3 R3.043.66
The latest lockdown version
Title: Re: reference Script
Post by: Hood on April 24, 2013, 03:11:27 AM
Ok well that does not surprise me ::) the latest lockdown and Dev versions have lots of issues and in my opinion should not be available for download or if they are  they should at least have  a warning that they have issues.
I am not saying that is definitely your issue but I am fairly confident it is, download and install an earlier version and see if it cures your issues, I use 056 and 057 on my machines but anything up to 062 may be ok, you will find them here.
ftp://machsupport.com/Mach/

Hood
Title: Re: reference Script
Post by: 1hxo on April 24, 2013, 04:03:50 AM
Ok i give different version a try.
Only with over installing the version.
test script:
 DoButton(22)
 While IsMoving()
 Wend
 Code "G53 G0 X0"
version 0.56 crash i must restart mach3 nothing happens
version .057 the same
up to version .060 the script does the same at my first try's
At this point i think its the pokeys mach3 plugin.
I dont can try this on an lpt port.
But when i use Code "g0 x10" instead of Dobutton(22) the script runs fine.
As soon as i use Commands for reference Like dobutton(22) or G28 the script hangs after do the first commando and then i must press reset or stop then the script runs to his end.
running this script on a lpt port as it should? When this script running fine on a lpt port then the mach3 pokey plugin has a fault.
Title: Re: reference Script
Post by: Hood on April 24, 2013, 05:06:40 AM
Ok instead of
DoButton(22)
 try
DoOemButton(1022)

Hood
Title: Re: reference Script
Post by: 1hxo on April 24, 2013, 06:02:18 AM
7Always the same.
And always with the homing function.All other makro's run fine.
i'm not able to move the axes to a point after reference with a script.mach3 stop always after execute dobutton(22), dooembutton(1022) or a g28 command and wait that i push the stop button that he can execute the rest of the script.

Title: Re: reference Script
Post by: Hood on April 24, 2013, 06:34:59 AM
Looks like it is a PoKeys issue then, maybe it needs the latest version of Mach? I do know there are issues with the latest versions and homing scripts as I had them, it would need 2 or 3 executions of the script before it would complete fully.
Hood
Title: Re: reference Script
Post by: stirling on April 24, 2013, 06:36:30 AM
It looks to me like you're correct - there's a problem with the plugin. The homing behavior you describe in your first post is wrong. It should set machine zero AFTER it's backed off the switch AND come to a stop.

Try replacing your while isMoving construct with this:

Code: [Select]
while isMoving() and (X < 100)
  X = X + 1
  sleep 100
wend

This will release the while loop after 10 seconds regardless.

This is NOT a fix for the homing problem - it will just show that homing is not finishing and therefore Mach is not releasing the isMoving semaphore.

Ian
Title: Re: reference Script
Post by: 1hxo on April 24, 2013, 08:00:05 AM
When i replace the script part with yours:
 dobutton(22)
 While isMoving() And (X < 100)
   X = X + 1
   sleep 100
 Wend
 code "g0 x10"
Then the script do a x ref then hangs 10 seconds then release the hang.
But it dont execute the following command and it dont hang.
I know its not a fix for my problem.
But it release mach3 without push stop button
I have seen written an email to the developer times whether there is a solution for.
Maybe give an another solution for this problem?
Title: Re: reference Script
Post by: stirling on April 24, 2013, 08:21:44 AM
The code "g0 x10" won't get executed because Mach is still waiting for the movement queue to empty before it will execute it. All the script does is show that VB is NOT hung and that it is isMoving that is not releasing. That more or less proves (to me at least) that the homing sequence is not only not working as it should but that it is NOT returning control to Mach either.

Ian
Title: Re: reference Script
Post by: 1hxo on April 28, 2013, 07:36:03 PM
Yes your are right.
Its an error with the pokeys plugin.
I have now connect my stepdriver to the lpt port to see how it should run normally.And when i use LPT port as controller and the pokeys as IO board all works very well.
and i must not write a script because mach3 makes all.
Also the softlimit function runs fine.with pokeys plugin not.

thanks for the food for thought
Title: Re: reference Script
Post by: NeoTO on March 17, 2014, 03:19:47 AM
Just some clarification after receiving a question about a similar problem to e-mail...

The isMoving() bug should have been solved in one of the last year's updates.

Regarding homing procedure and why machine is stopped at location not equal to zero: homing procedure is there not for positioning the machine itself to zero, but solely for the control system to know where the zero position is. Since connection between PoKeys and Mach3 does not allow high speed operation as in case of LPT port, PoKeys device does homing and probing operations by itself (as any other external motion controller). PoKeys does it this way:
- return towards home switch until switch is hit
- slowly back-off the switch until switch is released
- in the exact moment when the switch is released, the position of the machine is saved (reset) and machine is commanded to a stop. Since the velocity of the machine at this point is greater than 0, it can not be stopped instantaneously, but moves a few ticks away from home position.
So, internal position counters are precisely reset at home position although the machine stops out of it. It might be different from Mach3's own homing, but the procedure above was proved to be very reliable and accurate on different machines.

Regarding the need for the latest Mach3 version: due to bugs, there have been changes to the internal structures that Mach3 exposes to plugins. As Mach3 plugins require the exact same memory alignment as it was used when compiling the plugin, the latest Mach3 version is required for PoKeys plugin. As certain PoKeys plugin functions require the new bug-free version of Mach3, we can not simply compile it agains an older SDK as it would break the plugin functionality.