Machsupport Forum

Mach Discussion => Brains Development => Topic started by: Fredrich on May 06, 2023, 10:49:47 AM

Title: Execution M00 for Brains
Post by: Fredrich on May 06, 2023, 10:49:47 AM
Hello everyone! I am in a project with a CNC Mortiser and I am trying to experiment with brains and macros to be able to make a sensor activate input1 when the tool is working so that the Y and A axes stay in standby mode, until the sensor turns off. deactivate and resume their work without losing position. I tried with a brain configuring the input and placing FeedHold, but it takes about a second to slow down its progress, I need something similar to M00 and that respects the acceleration ramps to obtain a better response based on the machining of the machine. I also tried "Stop all actions" or "EStop" but being so abrupt its stop ended up losing positioning in my axes.

I would appreciate a soul wanting to give me a hand to continue with the project, soon I will add photos and videos to show you the final results. Thank you all very much in advance and have a good day!

Best regards, Fred.
Title: Re: Execution M00 for Brains
Post by: Graham Waterworth on May 07, 2023, 05:03:33 PM
Why can you not use g-code?
Title: Re: Execution M00 for Brains
Post by: Fredrich on May 08, 2023, 08:52:57 AM
Hello Graham! :D
I am subject to the external variable, which is the speed that the spindle works, I don't know at what speed this machine is going to be working... that's why I want the sensor that the machine is going to have to activate M00.

Best regards,
Fred
Title: Re: Execution M00 for Brains
Post by: Graham Waterworth on May 08, 2023, 01:13:43 PM
I need a better explanation of what you are trying to do.

If you do not know the distance the X axis needs to travel then you could put the sensor into the G31 skip signal and a soon as the signal is seen the X axis stops moving and the next line of code continues.

G01 G31 X300. F250. keeps moving until the skip signal is triggered or X gets to 300.

Title: Re: Execution M00 for Brains
Post by: Fredrich on May 09, 2023, 08:21:04 AM
I need the program to pause, that when it detects the sensor signal, it will be placed in a pause state until the sensor is activated again to continue with the G-code procedure. I succeeded, but, M01 and FeedHold have a very slow response time. Slow for this type of work.
The only thing it could do with this was M00, but programmed within g-code. (I don't want to have to program it within g-code)
I was able to call it from a macro via an input signal, but I don't get the same response time; I wanted to try it with a brain but I can't find a way to run the M00 with the...

I would appreciate any help to solve this problem.

I add;
The machine gives 88 blows per minute maximum, and vertically. I need to deal with those specs.

Kind regards,
Fred
Title: Re: Execution M00 for Brains
Post by: TPS on May 10, 2023, 02:27:25 AM
have you tryed to use Buttonpress -> 1003- Stop File in your brain?
should do the same like M00. 
Title: Re: Execution M00 for Brains
Post by: Fredrich on May 10, 2023, 08:19:14 AM
Hi Thomas, how's it going? I hope it's ok.
I tried, but the OEM 1003 is very harsh in response and throws my engines out of step.
On the other hand, M00 is instantaneous but respects the acceleration and deceleration ramps.
I need an interval between EStop and FeedHold. I thought I could somehow run M00 from the brains since they have a much higher response time than the macropumps.

Kind regards,
Fred.
Title: Re: Execution M00 for Brains
Post by: Fredrich on May 10, 2023, 09:22:44 AM
I add, perhaps the macrobombs have not worked for me due to bad programming...

Do
   If IsActive(Input1) Then
      Code "M00"
      While (IsActive(Input1))
         Sleep(100)
      Wend
   End If
Loop

According to my understanding this goes inside a MXX.m1s file and calling it from a button or input pulse, as one understands... Correct me if I'm not right.
From already thank you very much.

Pd:
I'm kind of new to this at the moment... :-X
Title: Re: Execution M00 for Brains
Post by: TPS on May 10, 2023, 10:22:07 AM
Hi Fred,

your code snipped will freeze the system because of your Do Loop.

you can try to use a OEMTrigger to run a macro.
how this is done i explained here:
https://www.machsupport.com/forum/index.php?topic=46414.msg293415#msg293415

but i am affraid that all this will be to slow anyhow.

without knowing exactly what the machine should do, it is very hard to think about possibilties.
Title: Re: Execution M00 for Brains
Post by: Fredrich on May 10, 2023, 11:50:18 AM
Tomas,
The machine makes gears, it gives 88 blows per minute maximum... I need a faster pause response because when the machine is going to hit to grind the piece, its axes remain frozen until the tool returns to the top. Maybe with this I can clarify some doubts...
From already thank you very much,
Kind regards,
Fred.
Title: Re: Execution M00 for Brains
Post by: Fredrich on May 10, 2023, 01:35:12 PM

Tomas,
In this case I can't find the function to add a macro to the OEMTrigger


Hi Fred,

your code snipped will freeze the system because of your Do Loop.

you can try to use a OEMTrigger to run a macro.
how this is done i explained here:
https://www.machsupport.com/forum/index.php?topic=46414.msg293415#msg293415

but i am affraid that all this will be to slow anyhow.

without knowing exactly what the machine should do, it is very hard to think about possibilties.
Title: Re: Execution M00 for Brains
Post by: TPS on May 11, 2023, 02:15:40 AM
Example:

1.assign your input in Config-> Ports & Pins -> Input Signals to OEM Trig #1 (keep the original assignment for input1)


2. Config->System hotkeys oemcodes -> external buttons OEM Code -> Trigger #1 - set 301

3. Config->General Config ->Initialisation string  M333, that means every time you reset M333.M1s is called

4. create  M333.M1s in your macro folder and add the VB code:
Code: [Select]
SetTriggerMacro(334)


so every time the OEMTrigger#1 comes True the VB Code within M334.M1S will run once.

code for M334.M1s wil be something like this

Code: [Select]
   If Oemtrigger(1) Then
      Code "M00"
      While (IsActive(Input1))
         Sleep(100)
      Wend
   End If

but as mentoined i think this will be to slow.

as Graham mentoined earlier G31 might be the right direction.

Title: Re: Execution M00 for Brains
Post by: Fredrich on May 14, 2023, 09:03:46 PM
Hello Tomas. how are you?
I hope it's ok. I have been trying to execute this macro and I have been able to, I have the following error, when executing the macro it says "script compile error m334", according to my deduction it is that some configuration or an error in the development of the M334... I have it exactly as I want you have developed it. When I run the macro the axes don't stop moving while the G code runs.

Kind regards,
Fred.
Title: Re: Execution M00 for Brains
Post by: TPS on May 15, 2023, 02:13:25 AM
sorry, my fault:

Code: [Select]
If IsActive (OEMTRIG1) Then
      Code "M00"
      While (IsActive(Input1))
         Sleep(100)
      Wend
End If
Title: Re: Execution M00 for Brains
Post by: Fredrich on May 15, 2023, 08:48:43 AM
Hello Thomas, how are you again? I hope it's ok!
I'm testing the script you gave me and it seems to work correctly, that's great.
At this moment I have another problem, apparently the macro is executed when the G code finishes running, let's say; While the axes are running the coordinates this macro appears to be invalid. Maybe I did some wrong configuration...
I add that input1 is also being emulated when activating oemtrigger#1.

Thank you very much for your help, you are being very useful for me.
Kind regards,
Fred.

sorry, my fault:

Code: [Select]
If IsActive (OEMTRIG1) Then
      Code "M00"
      While (IsActive(Input1))
         Sleep(100)
      Wend
End If
Title: Re: Execution M00 for Brains
Post by: TPS on May 15, 2023, 12:38:42 PM
i was affraid that this problem will come up, because code from macros is added into the queue.

so as Graham mentoined, G31 will be the road to go.
Title: Re: Execution M00 for Brains
Post by: Fredrich on May 15, 2023, 01:38:31 PM
Is it possible to execute G31 with the pulse of input1 and pause the G code? or will it also be added to the queue?

Kind regards,
Fred.
i was affraid that this problem will come up, because code from macros is added into the queue.

so as Graham mentoined, G31 will be the road to go.
Title: Re: Execution M00 for Brains
Post by: TPS on May 15, 2023, 02:13:57 PM
if you have a look in here:

http://support.machsupport.com/de/downloads/files/using-mach3-mill/download

chapter 10.7.12 explains, what G31 will do.

basicly G31 will stop movement triggered by an input signal.
it will not continue after input signal goes off again.
this wil have to be done by logic within a macro, the benfit is that the movement will
be stopped imediately.

i don't know where your GCode is coming from, but someting like a GCode "converter",
VB macro, might be the way to go.

can you post a sample GCode to see how it looks like.   
Title: Re: Execution M00 for Brains
Post by: Fredrich on May 15, 2023, 03:52:48 PM
Tomas, apparently the link you gave me is damaged or for something it won't let me access this information.
What do you mean by VB macro converter?
What I want to say and maybe I don't explain it well is that I need the program to pause when it detects the input signal input1, it is to prevent the gcode from continuing to play in the program until the mortiser tool is removed from the zone work, until the break is resumed. It would work very much like the MPG function... Only MPG won't be of any use to me in this case either.
Excuse my ignorance on the subject, maybe I'm still a bit fresh on this.

Kind regards,
Fred.

if you have a look in here:

http://support.machsupport.com/de/downloads/files/using-mach3-mill/download

chapter 10.7.12 explains, what G31 will do.

basicly G31 will stop movement triggered by an input signal.
it will not continue after input signal goes off again.
this wil have to be done by logic within a macro, the benfit is that the movement will
be stopped imediately.

i don't know where your GCode is coming from, but someting like a GCode "converter",
VB macro, might be the way to go.

can you post a sample GCode to see how it looks like.
Title: Re: Execution M00 for Brains
Post by: TPS on May 16, 2023, 02:56:53 AM
the link downloads a file named Mach3Mill_1.84.pdf. pls check your download folder.

anyway, i do not know a possibility to pause a program by digital input.

with a vb macro converter i mean a VB macro witch reads the original GCode and
creates new program with use of G31.

that's why i asked for a sample GCode file witch will be used on the machine.
Title: Re: Execution M00 for Brains
Post by: Fredrich on May 17, 2023, 09:46:12 AM
Hello Thomas, how are you? I hope it's ok. I am attaching the G code, which is the working model of the machine... The movement of the Y and A axis are the ones that definitely pause and resume the program.
I also attached an approximate video of what I need to develop.

https://www.youtube.com/watch?v=3EzxVWbfzBE
https://www.youtube.com/watch?v=uTg2jy6O4uw

Kind regards,
Fred.

the link downloads a file named Mach3Mill_1.84.pdf. pls check your download folder.

anyway, i do not know a possibility to pause a program by digital input.

with a vb macro converter i mean a VB macro witch reads the original GCode and
creates new program with use of G31.

that's why i asked for a sample GCode file witch will be used on the machine.
Title: Re: Execution M00 for Brains
Post by: TPS on May 18, 2023, 04:14:57 AM
Hello Fred,

how is the stroke driven ? Hydraulic or excenter drive or?

usualy there is more then one stroke per a position,but does not matter ?

so the sequence would be

-ckeck stroke is up
-Y-axis to a save positon for turn
-turn A-axis
-Y-axis to the first position
-stroke down
-Y-axis back
-stroke up
-Y-axis to the next position
-stroke down
-Y-axis back
-stroke up

and so on until Y-axis depth is reached
then if necessary the same for next a position.
Title: Re: Execution M00 for Brains
Post by: Fredrich on May 19, 2023, 11:27:12 AM
Hello Thomas, how are you?
He's eccentric...
And in this case, what would the g code look like?
My other question is, how does the control know not to move until the tool stops making the pass?
To all this, for this reason I wanted to make the signal enter through a sensor to execute M00 and that the program is in a state of pause until the tool is withdrawn..

Kind regards,
Fred.


Hello Fred,

how is the stroke driven ? Hydraulic or excenter drive or?

usualy there is more then one stroke per a position,but does not matter ?

so the sequence would be

-ckeck stroke is up
-Y-axis to a save positon for turn
-turn A-axis
-Y-axis to the first position
-stroke down
-Y-axis back
-stroke up
-Y-axis to the next position
-stroke down
-Y-axis back
-stroke up

and so on until Y-axis depth is reached
then if necessary the same for next a position.
Title: Re: Execution M00 for Brains
Post by: TPS on May 19, 2023, 02:13:12 PM
OK inthis case you will need two signal's

-excenter in top position
-excenter in bottom position

-how will the excenter drive be controlled? simple On/OFF by relay?

-what will do the feed forward, if there is more then one stroke at a position ? Y-Axis?

-has it to do a small step backward's when the stroke goes up?

question's and more question's.
Title: Re: Execution M00 for Brains
Post by: Fredrich on May 19, 2023, 08:15:43 PM
Tomas, your help at this time is greatly appreciated.
The machine does not need to be withdrawn because the tool mechanically withdraws itself by returning to the top of the eccentric.
This is when I need that when the tool is on the material, it does not move, that it remains paralyzed until the eccentric is at the top...
On the other hand, the eccentric drive is indifferent to mach3, it works manually depending on the operator.
Deals a single hit for every 4 hundredth advance. I am available for any kind of question you want to ask.

Kind regards,
Fred.

OK inthis case you will need two signal's

-excenter in top position
-excenter in bottom position

-how will the excenter drive be controlled? simple On/OFF by relay?

-what will do the feed forward, if there is more then one stroke at a position ? Y-Axis?

-has it to do a small step backward's when the stroke goes up?

question's and more question's.
Title: Re: Execution M00 for Brains
Post by: TPS on May 20, 2023, 10:18:31 AM
so you will only need a simple macro.

for example m123.m1s

Code: [Select]
If IsActive (Input1) Then
      Sleep(100) 'wait for input to go off
End If
Sleep(100)
If Not IsActive (Input1) Then
      Sleep(100) 'wait for input to go on again
End If


and GCode would look like:

Code: [Select]
m3
m7
f300
g0a0
g1y-20
g0y-15
m123
g0a20


g1y-20
g0y-15
m123
g0a40

.....

then macine wil go to position an wait for Input1 to be OFF and ON again
Title: Re: Execution M00 for Brains
Post by: Fredrich on May 20, 2023, 11:31:09 AM
Hello Thomas, how are you?
Does this macro have to be configured as a macrobomb? How did we try it before or just create the macro, enter the values ​​and it will automatically run itself?

Kind regards,
Fred.

so you will only need a simple macro.

for example m123.m1s

Code: [Select]
If IsActive (Input1) Then
      Sleep(100) 'wait for input to go off
End If
Sleep(100)
If Not IsActive (Input1) Then
      Sleep(100) 'wait for input to go on again
End If


and GCode would look like:

Code: [Select]
m3
m7
f300
g0a0
g1y-20
g0y-15
m123
g0a20


g1y-20
g0y-15
m123
g0a40

.....

then macine wil go to position an wait for Input1 to be OFF and ON again
Title: Re: Execution M00 for Brains
Post by: TPS on May 20, 2023, 01:16:55 PM
no, you have to create a macrofile in your macrofolder (normaly C:\Mach3\macros\ your profile name) with
the name M123.M1S, plain Textfile (notepad or simular), then copy the posted code into the file.

the GCode will call the Macro:

g1y-20
g0y-15
M123
g0a40

and the code in the macro will "wait"/"pause" until Input1  goes OFF and ON again.
Title: Re: Execution M00 for Brains
Post by: Fredrich on October 31, 2023, 10:41:29 AM
Hi Thomas,
It has been of great help to me for this project. The shroud is working correctly thanks to you and those who were able to give me a hand.

I finally managed to make it work with M1 which is activated with an external signal.
What I couldn't achieve was to generate that macro we talked about so I could make the machine do it automatically. I figure that later I'll be able to sit down and experiment a little more with this.
I leave the link so you can see how the project turned out.
Kind regards,

https://www.youtube.com/watch?v=DytJubEY_OM

Fredrich.





no, you have to create a macrofile in your macrofolder (normaly C:\Mach3\macros\ your profile name) with
the name M123.M1S, plain Textfile (notepad or simular), then copy the posted code into the file.

the GCode will call the Macro:

g1y-20
g0y-15
M123
g0a40

and the code in the macro will "wait"/"pause" until Input1  goes OFF and ON again.