Hello Guest it is April 27, 2024, 09:36:51 AM

Author Topic: JogOn and JogOff in Macros  (Read 559 times)

0 Members and 1 Guest are viewing this topic.

JogOn and JogOff in Macros
« on: November 29, 2023, 12:19:55 PM »
Dear All,
I am new to use Mach3 and I am using this in a completly diffrent way with an entirely diffrent purpose. It's going to controll a very precise pick&place unit. For this I will have to teach positions. All this will run on a Windows 11 Platform  and is programed in  C#. I require two very simple Macros. I called them M910 and M911. M910 is used to start jogging the X Axis in positive direction. It is the single comand JogOn(0,0) , M911 is JogOff(0). Both are working fine in the VB Script Editior, but as soon as I call the Macros as an MDI, nothing happens. Do you have an idea what is going wrong or what I need to do to get this working. Thank you in advance and best regards from a snowy Germany

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: JogOn and JogOff in Macros
« Reply #1 on: November 29, 2023, 01:22:54 PM »
only idea i have is that your M910 and M911 are not in the right folder?
folder should be in

C:\Mach3\Macros\Your profile name

and they should have the extibsion .M1S
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: JogOn and JogOff in Macros
« Reply #2 on: November 29, 2023, 01:35:56 PM »
Hello  TPS,
Name and extension is correct and file is in the correct folder, because, if I add a message("Jogging X") to the Macro, the message is propperly displayed.

Offline Graham Waterworth

*
  • *
  •  2,673 2,673
  • Yorkshire Dales, England
    • View Profile
Re: JogOn and JogOff in Macros
« Reply #3 on: November 29, 2023, 06:38:06 PM »
You may need a short delay after the M code

M910
While IsMoving
  sleep(25)
Wend
Without engineers the world stops
Re: JogOn and JogOff in Macros
« Reply #4 on: November 30, 2023, 03:56:58 AM »
Hello Graham,

Hello Graham,

thank you for your response, but...
This is how my macro is looking now:

i = 0
JogOn(1,0) 
While IsMoving
  sleep(25)
  i = i + 1
Wend
Message "Macro done " & i

This time I gave y-Axis a try.
I set Jog-Mode to step
If I run M910 from MDI, Status is Macro done 0, Axis is not moving
If I run the code in the Editor without breakpoints, Status is Macro is done 0, but Axis is moving 1 Step as defined. Jogon is working, while IsMoving appears to be ignored
if I run the code in the Editor with a Breakpoint at JogOn and step through the code, everything is working as expected, Status is Macro done 16.
Isn't this funny?  8{
Doing the same in continous jog mode:
If I run M910 from MDI, Status is Macro done 0, Axis is not moving
If I run the code in the Editor without breakpoints, Status is Macro is done 0, but Axis is moving endless. Jogon is working, while IsMoving appears to be ignored
if I run the code in the Editor with a Breakpoint at JogOn and step through the code, everything is working as expected, writing the status is never reached, as expected (jog is running continously).

Nobody out there, who has a board connected and can simulate this? Not even a stepperdriver needs to be attached.

Thank you all

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: JogOn and JogOff in Macros
« Reply #5 on: November 30, 2023, 06:32:25 AM »
tested this code over here, also used M900.M1s

Code: [Select]
Code "F1000"
 JogOn(0,0)

in MPG Step mode, however i had to set a speed first, then is was working.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: JogOn and JogOff in Macros
« Reply #6 on: November 30, 2023, 09:29:30 AM »
Hello TPS,

are you having a MPG Unit connected? And is it working when you are calling the Macro from MDI or inside a G-Code File?
In my case it is working only in the Editor Window, I do not have a MPG connected. Might this be the reason? Strange...

Best regards

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: JogOn and JogOff in Macros
« Reply #7 on: November 30, 2023, 10:15:10 AM »
i have no physical mpg connected.
i created a macro in my macro folder and run it via MDI and it was working.

i tested with Version R3.043.022
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: JogOn and JogOff in Macros
« Reply #8 on: November 30, 2023, 11:42:40 AM »
I am using the .62 in Demo Mode. What are your settings? if I am running in MPG-Mode it is not working at all. Sorry for bothering you with this BS

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: JogOn and JogOff in Macros
« Reply #9 on: November 30, 2023, 02:02:05 PM »
for the test i use the "virtual" MPG from 1024 screenset by pressing the TAB key.

then i switch the Jog Mode to Step
choose Mode Single Step
select Cycle Jog Step with the button for example 1.0
then call M900 in MDI and it moves 1.0 mm in my case.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.