# GRBL - M98 Command Error



## vmgobinath (Feb 13, 2020)

Dear All,

I have tried to repeat the whole process via the M98 P0 L2 command. But I got below error msg.



''An error was detected while sending 'M98P0L2': (error:20) Unsupported or invalid g-code command found in the block. Streaming has been paused
''

GRBL version: 1.1
Software : UGS

Anyone Help me out.


----------



## PhilBa (Sep 25, 2014)

GRBL doesn't support O-codes (subprograms) so it's not a surprise that M98 is unsupported. You'll need to make your G-Code to do the operations inline.


----------



## vmgobinath (Feb 13, 2020)

PhilBa said:


> GRBL doesn't support O-codes (subprograms) so it's not a surprise that M98 is unsupported. You'll need to make your G-Code to do the operations inline.


Thanks a lot. Could you please tell me how to repeat the whole program up to a certain time (Example: 40 times) with GRBL command?


----------



## PhilBa (Sep 25, 2014)

vmgobinath said:


> PhilBa said:
> 
> 
> > GRBL doesn't support O-codes (subprograms) so it's not a surprise that M98 is unsupported. You'll need to make your G-Code to do the operations inline.
> ...


Well, if you are writing G-Code by hand you just write the operations 40 times. If you are using CAM then it depends on what you are using. Also, you will need to select a GRBL post processor.


----------



## vmgobinath (Feb 13, 2020)

PhilBa said:


> Well, if you are writing G-Code by hand you just write the operations 40 times. If you are using CAM then it depends on what you are using. Also, you will need to select a GRBL post processor.


You mean to say, repeat the whole program by 40 times? 

Sorry, I am new, my understanding below. Is it correct?

My Program - I have repeated 2 times ... IS it like that I have to repeat 40 times?

G90
$H
M3S0
Z0
X -42.5
Y - 35.5
Z 4
Y -37
Y -37.1
Z4.5
M3S45
Z1
Y0
X0
M3S0
Z0


G90
$H
M3S0
Z0
X -42.5
Y - 35.5
Z 4
Y -37
Y -37.1
Z4.5
M3S45
Z1
Y0
X0
M3S0
Z0
.....
..
...
..
...


----------



## PhilBa (Sep 25, 2014)

Yes. 

But, are you actually coding by hand? You should really be using CAD and CAM. Coding by hand for anything but ultra simple things is going to get old very very fast.

And, just looking briefly at your G-Code, I suspect you are missing some key points like for the Z axis, down/lower is usually negative. And M5 is a better way to turn off your spindle than M3S0. Have you watched any tutorials?


----------



## MEBCWD (Jan 14, 2012)

Are you wanting to cut 40 items at a time? If so you would also need to add code to move to each location of the items. Why not design the job with the number of desired items allowing for bit size then run Cam on the job?


----------



## vmgobinath (Feb 13, 2020)

PhilBa said:


> Yes.
> 
> But, are you actually coding by hand? You should really be using CAD and CAM. Coding by hand for anything but ultra simple things is going to get old very very fast.
> 
> And, just looking briefly at your G-Code, I suspect you are missing some key points like for the Z axis, down/lower is usually negative. And M5 is a better way to turn off your spindle than M3S0. Have you watched any tutorials?


Thanks for your reply. This is a mini CNC router. I am using my Z-axis as a gripper with a servo motor. M3S0 is Opening the gripper and M3S45 closing the gripper.


----------



## PhilBa (Sep 25, 2014)

Ah, that makes more sense. Though to be honest, your use is pretty far from what we normally see 'round these here parts, pardner. What is this for? Some sort of chess machine?


----------

