Hello Guest it is April 24, 2024, 06:27:02 PM

Author Topic: why my M6Start.m1s doesnot run?  (Read 4281 times)

0 Members and 1 Guest are viewing this topic.

why my M6Start.m1s doesnot run?
« on: September 28, 2016, 08:37:28 AM »
hello dear forum

no matter what I tried I couldnot get my M6Start.m1s run

is it becouse that my mach 3 is demo mode ? ( i.e. not licensed )

thank you

Code: [Select]
Sub Main()

tool = GetSelectedTool()

ActivateSignal(OUTPUT3)
Code "G4 P3"
While IsMoving ()       
Wend
DeActivateSignal(OUTPUT3)  'Engage Turret holding pin     

SetCurrentTool(tool)

End Sub Main()
Re: why my M6Start.m1s doesnot run?
« Reply #1 on: September 28, 2016, 12:51:17 PM »
A couple of things:

First, I don't think you need a licensed version for running the macros.  The only limitation that I'm aware of is number of lines in a program (500 IIRC).

Second, make sure you're looking at the correct location for your M6Start.m1s (and all other macros as well).  In the Mach3 folder there is a folder called "macros".  Inside that folder are other folders such as Mach3Mill, Mach3Turn, etc.  You should also have a folder with the same name as the icon and .xml file you use to start Mach3.  In my case, there is a folder named 6040Z and that is where the macros are stored for when I start up Mach3 with an icon also named 6040Z that uses an .xml configuration file in the Mach3 folder also named 6040Z.xml so as you can see, everything matches up.  If I edit a macro in the Mach3Mill folder for example, the changes would not show up when I run Mach3 from the 6040Z icon.

Finally, I don't believe the Sub Main() and End Sub Main() are needed here and this may be part of the problem.  This may cause the code within the Main() to not execute depending on how Mach3 VB interpreter handles that.  I have not used them in my code nor have I seen it used in other macros (out of the box defaults that are installed with Mach3) and everything works just fine.

Hope that helps,

Stephen "Highspeed" Kruse
Re: why my M6Start.m1s doesnot run?
« Reply #2 on: September 28, 2016, 08:29:50 PM »
hello thank you,

when I removed the lines - sub main () end sub main()
the macro has worked

I can see it dwell and change tool number

however the line ActivateSignal(OUTPUT3) doesnot work
cant see it blinking red in diagnostics page

help needed
Re: why my M6Start.m1s doesnot run?
« Reply #3 on: December 01, 2016, 01:51:41 AM »
Hi magnetron,
I was messing around with some code and I couldn't get ActivateSignal(Outputnnn)
to work either.
While I don't know for sure I believe that is a very old instruction and is no longer functional
it latest releases of Mach3.

This did work:
DoOEMButton(233) ; turns on output 4 if enabled in 'ports and pins/outputs'
DoOEMButton(234) ; turns output 4 off.

Couldn't find the OEM button numbers for outputs 1,2 or3 but OEM button numbers for
outputs 4,5 and 6 are in the OEMButton list of Mach3_V3.x_Macro_Prog_ref.pdf on the Arsoft
website.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline Tweakie.CNC

*
  • *
  •  9,199 9,199
  • Super Kitty
    • View Profile
Re: why my M6Start.m1s doesnot run?
« Reply #4 on: December 01, 2016, 02:32:32 AM »
Quote
I was messing around with some code and I couldn't get ActivateSignal(Outputnnn)
to work either.
While I don't know for sure I believe that is a very old instruction and is no longer functional
it latest releases of Mach3.


Not trying to confuse but if it’s any help…

ActivateSignal(OUTPUT3)
and
DeActivateSignal(OUTPUT3)

Work just fine here with latest versions of Mach3 (obviously, the particular Output# has to be enabled etc.)

(However, there’s nowt so fickle as CB   ;)  )

Tweakie.
PEACE
Re: why my M6Start.m1s doesnot run?
« Reply #5 on: December 01, 2016, 03:37:28 AM »
Hi Tweakie,
after reading your post I went back and tried it again and bugger me ActivateSignal(OUTPUTx) and
DeactivateSignal(OUTPUTx) work.

I spent half an hour earlier today trying different formats etc to no avail. Maybe it was the logic (read illogic)
of the rest of the code that was the problem.

Now, while I have you 'on the line' as it were...
I was trying to help a bloke who wanted to activate a device while an axis was moving. His attempt
was to code M11 P********* after a move.
I explained my understanding (yes a very scary thought...) that the move would complete before the
M code is read and executed. Am I correct?

Whether or not I suggested this (as a macro)

code("G01 X100 y0") ;the move
while IsMoving()
If getOEMDRO(800)>20 then ActivateSignal(OUTPUT4)
wend

and it seemed to work.
My question: is there some logic to the situation where a new instruction is read and executed before
a previous move is completed and apparently some instructions have to complete before the next instruction
is executed?

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline Tweakie.CNC

*
  • *
  •  9,199 9,199
  • Super Kitty
    • View Profile
Re: why my M6Start.m1s doesnot run?
« Reply #6 on: December 01, 2016, 06:06:39 AM »
Hi Craig,

Yes, I did look at this but pressure of work is not giving me enough time to look at anything in detail at the moment.
The M11/M10 commands are perhaps not the best ones to be using for this particular application, mainly because they only operate at the instant of the start of a following axis movement. They can be fooled by using an imaginary axis (such as the B axis whereby the code may look something like M11P1 B0 / M10P1 B1) but it would have to be tested to see if it could be made to work within your While IsMoving() loop. In addition I have no idea how the M11/M10 commands will behave if called whilst an axis is already moving.

Not much help really, sorry.

Tweakie.
PEACE