MadModder
The Shop => CNC => Topic started by: Will_D on February 13, 2018, 10:14:52 AM
-
AS you have seen from previous posts I have been trying to understand the control language that enhances G-Code.
I wrote a simple routine:
(Safe Block)
G17 G21 G90 G54 G40 G49 G80
(Read the current tool mechanical coordinate position i.e MACH workspace)
(#20 is X, #21 is Y, #22 is Z)
#20=#864
#21=#865
#22=#866
(I want things nice and slow)
F50.0
IF #22 LT 20 GOTO 1; If Z < 20
G01 Y#21 - 10; Z is > 20 so Move Y minus 10
GOTO 2
N1 G01 X#20 + 10; Z is < 20 so Move X plus 10
N2 M30
%
and it actually works!!
Next is to try to get subroutine calls working
BTW: I read on another forum that if you select a file on the memory stick and press start (i.e. the file is not loaded yet) you get the tool path window showing a simulation of the code!
Onwards and upwards
-
How about loops:
(Safe Block)
G17 G21 G90 G54 G40 G49 G80
G00 X0.0 Y0.0 Z0.0
#11 = 3
F 50.0; Nice and slow
(Test Loop processing)
N5 WHILE #11 > 0 DO 13
G01 X10.0
G01 X0.0
G04 P5000; 5 second delay
#11 = #11-1; The number of cycles decreases
END 13
M30
%
The above works a treat! :bugeye:
-
And now here is a subroutine:
(Safe Block)
G17 G21 G90 G54 G40 G49 G80
(Investigate Subroutines)
(set initial X, Y and Z)
G01 X0.0 Y0.0 Z0.0 F100
#1 = 3.888
G01 Z2.0
G01 X FIX[#1]; Round Down
G01 Y FUP[#1]; Round Up
G04 P5000; Little delay
(Note the above has nothing to do with testing the subroutine mechanism!!)
M98 P456 L3; Call subroutine 3 times
M30; End main Program
%
(Declare the Sub)
O456
G91
G01 X2.0 F50
G90
G04 P3000; Little delay
M99; End of Sub
%
Hope this helps
Cheers
Will
-
Bravo..... Fantastico..... Hai provato a fare un probe e vedere se dentro al programma ti parte la sonda per ricercare lo zero pezzo e poi riparte? Tipo la torcia del plasma.... Grazie
-
Thanks Cosimo. Still working on probing.
Can I recommend this link:
https://www.google.ie/search?q=italian+to+english&rlz=1C1CHBF_enIE721IE721&oq=ita&aqs=chrome.0.35i39j0j69i57j0l3.4286j0j8&sourceid=chrome&ie=UTF-8 (https://www.google.ie/search?q=italian+to+english&rlz=1C1CHBF_enIE721IE721&oq=ita&aqs=chrome.0.35i39j0j69i57j0l3.4286j0j8&sourceid=chrome&ie=UTF-8)
Cheers
Will