Hello Guest it is December 06, 2019, 08:55:26 AM

Author Topic: Program stopped when encountering '#' statement  (Read 3004 times)

0 Members and 1 Guest are viewing this topic.

Program stopped when encountering '#' statement
« on: November 27, 2016, 08:11:12 PM »
Hi folks,

I'm Kyle from Singapore. Just started milling PCBs on my A2ZCNC/Sherline mill designed by a friend of mine. I was introduced to this software, Autoleveller (www.autoleveller.co.uk), which takes in an NC file and generate a new file with probing and height adjustments.

My first test with the test version of the autoleveller didn't go well. The software is simple to use. The codes generated looks good. But Mach3 refused to carry on after probing the 3rd time, when it encountered the assignment of the z tip position to the variable #500 (#500=#2002). The program should work as my friend whom has the almost the same setup as mine successfully ran the program.

I'm using Mach3 (Version R3.043.062) with a USB SmoothStepper and Gecko G540. Eagle was used with PCB GCODE to generate the NC file. The screenset used (if it matters) is the BigTex Machblue screen (the older version).

The segment of the code from the beginning to where it stopped:

(begin initial probe and set Z to 0)
G0 X0 Y0 Z0
G31 Z-10 F100
G92 Z0
G0 Z2
G31 Z-1 F50
G92 Z0
G0 Z2
G0 X0 Y0
G31 Z-1 F100
#500=#2002
G0 Z2

The message at Mach3 status bar: "begin initial probe and set Z to 0".

The machine did the 3 probes and stopped at z=0 after the 3rd.  The G0 Z2 right after the '#' statement didn't get executed.  I couldn't figure out what went wrong.  Could it be my settings in Mach3?  Prior to using this, I was probing and milling without any issue.

Anyone here can help?

Thank you.
Kyle
Re: Program stopped when encountering '#' statement
« Reply #1 on: November 29, 2016, 01:57:39 AM »
Hi wongster,
I use Autoleveller and its FANTASTIC! With it I cut boards at a cut depth of 60um on a
blank board with 35um (1oz) copper with perfect isolation, accuracy and finish. Tool wear
is also much reduced because you're not cutting excessive amounts of fibreglass.

Almost all of my boards now are SMT or at least contain SMT parts. Have done TSSOP packages
and 0603 resistors but hard to solder by hand so prefer SIOC and 1206 sizes. Prior to Autoleveller
I could not do these well but now no probs.

The version of Autoleveller you're using is the free one which 'levels' each file by including inline
calculations in your Gcode file. I found it to work but there is a better alternative. The subscription
version (20 British pound) generates a probe data file and then 'levels' each file presented to it
by generating a new Gcode file but does not rely on inline calcs. Provides a graphical view of the
probe data and can be reused without reprobing across several files on the top layer say.
Worth every pence IMHO. Additionally gives you access to the Autoleveller forum and the guy who
wrote it responds.

Craig
My wife left with my best friend...
     and I miss him!
Re: Program stopped when encountering '#' statement
« Reply #2 on: November 29, 2016, 03:37:35 AM »
Hello Craig,

Thank you for your respond and inputs. Appreciate it.

I'm pretty sold on the software but I just need it to work. The probing routine doesn't seem to be working with my setup. I've been searching online for an answer.  So far I see one possibility from a post on James' forum, which a friend forwarded me: changing the port which I wired the probe to Port 2 of the USB Smoothstepper. Currently it's on port 1.  I don't know how that will have but I'll try that to see if the issue can be resolved.

Do let me know if you think of anything.

Thank you once again.
Wong
Re: Program stopped when encountering '#' statement
« Reply #3 on: November 29, 2016, 06:36:16 PM »
Hi Kyle,
before I let the Aoutlevller augmented Gcode run I ALWAYS check to see if the probe is working.

Simple enuf, just watch for the probe LED on the diagnostics page while MDI'ing the tool into contact.
If the probe event is not detected the machine will continue to drive the tool down until it is detected
or to the lower limit declared in the G31 code, commonly 1mm. If a probe wire is not properly connected
or similar the board and/or the tool will be wrecked.

The version of Autolevller you are using will require that you fit a new tool and start again which is a real
problem if the PCB it part complete because the probe points will almost certainly isolated.

The subscribed version however allows you to fit a new tool due to breakage or wear, MDI down to a known
probe point, commonly 0,0 to touch off, zero Z axis then resume machining either from the beginning
or from where you left off with the 'Start From Here' button. The restart can be a bit tricky as Mach seems to
have a mind of its own when it comes to preparatory moves. With some experimentation the logic of how
its accomplished becomes clear and you can avoid certain disasters!

I have one board which is a high current inverter PCB and I'm using 12oz copper board, that is 420um!
To do this I have to take a couple of cuts to get thru the copper then on succeeding periphial cuts of
0.2mm wide at full depth. I require 5mm isolation as the inverter runs at 400Vdc. This means that the
board takes about 5 hours to cut. I have to use small 0.5mm endmills, small enuf to fit between SMT pads
and the taper of an engraving bit at 0.42mm depth is not acceptable. I replace endmills about hourly
so be able to restart after a toolchange is a must. The subscribed version of Autoleveller makes it possible.

Craig
My wife left with my best friend...
     and I miss him!
Re: Program stopped when encountering '#' statement
« Reply #4 on: November 29, 2016, 07:28:58 PM »
Hello Craig,

I'll try to do the test on G31 with MDI.  The Probe LED did light up when the vbit came in contact with the copper board and the melachine stopped, Z got zero'd, and retracted to the set Z2. This went on 3 times and on the 3rd, it stayed at Z0. The next statement is #501=#2002 followed by G0 Z2. I swapped these around (after G31, retract to Z2, then the #501=#2002), the machine retracted to Z2 after the 3rd time probing at X0Y0 and stopped.  So it appears to me that the #501=#2002 is line giving me the problem, though it's a valid statement.

Couldn't figure out what's wrong with this.  I do have the intention to purchase the AE if I can sort this out.

Could it be a setting I messed up in Mach3 that is causing this? The wiring of my probe? Probing still work when i do other job.

Thanks Craig.

Kyle
Re: Program stopped when encountering '#' statement
« Reply #5 on: November 29, 2016, 09:15:34 PM »
Hi Kyle,
you are correct, the probing is OK. The line using pound variables is at fault.

The first time I used Autoleveller I used the same version you are and it worked. Can only guess that your
version of Mach3 differs from my own.

Could it be than one or rather of the variables is invalid.

Try replacing the line with something like

#500=1.5
G0 Z5
M05

If it runs to completeion indicated by Z axis elevating to 5mm then #500 is valid.

In fact I just tried it in the MDI line here

#500=1.5 <enter>
G01  X #500 <enter>
and the X axis drove to X=1.5mm as expected.
I will do a little more experimenting and get back to you.

Craig
My wife left with my best friend...
     and I miss him!
Re: Program stopped when encountering '#' statement
« Reply #6 on: November 29, 2016, 09:56:57 PM »
Thank you so much, Craig!!!

I'll try this out when I get home tonight.
Re: Program stopped when encountering '#' statement
« Reply #7 on: November 29, 2016, 11:06:24 PM »
Hi Kyle,
have been experimenting and found a few useful things.

On the artsoft website under 'help and learning /product manuals/mach3 find and download a 'usage guide
to Mach3Mill'. Section 10 mentions pound variables and how to use them.

Under the 'operator menu' of Mac3 click 'Gcode Vari Monitor'. Enter the two variable numbers you are interested in,
500 and 2002 in your case and click update. The window should remain active so you can observe changes as you
MDI or run code.

I wrote this little Gcode snippet and it seems to work

#500=5
#2002=10
G4 P5
#500=50
#2002=100
G4 P20
#500=[#500/2]
M30
at least on my machine. Struggled to get the last arithmetic statement to work until I put square brackets
around it.
The straight assignment
#500=#2002
works. If it does not on your machine I would have to suggest that part of Mach3 is corrupt.
I found also that if the interpreter struggles with a line it puts an error code in the status line
at the bottom of most Mach3 screens.

Hopefully this will give you some tools to sort out what the problem is. Let us know how you
get on, the forum gets stronger when people share their solutions.

Craig
My wife left with my best friend...
     and I miss him!
Re: Program stopped when encountering '#' statement
« Reply #8 on: November 29, 2016, 11:30:46 PM »
Wow! Appreciate what you did, Craig!

I'll update once I get back to my machine.

Thanks man!
Re: Program stopped when encountering '#' statement
« Reply #9 on: November 30, 2016, 10:07:37 PM »
Hello Craig,

I did the test. The variables got updated alright. One thing I note after loading the codes into Mach3 was, the statement "#500=[#500/2]" didn't appear on the screen. Meaning, Mach3 only shows up to "P4 G20" in the box showing the gcode. When I click "Edit", that statement is in the nc file. Strange...

I still went ahead to run the program and saw that it works fine.

I don't know what else to try now...