Welcome! Log In Create A New Profile

Advanced

can't read all gcode lines or what?

Posted by okuzster 
can't read all gcode lines or what?
September 15, 2016 07:02AM
hi all,

i am creating gcodes for my delta with laser head atm. i know delta and laser is not a common couple but that's not the point now. i am generating gcodes from vector lines via rhino-grasshopper. grasshopper file is attached if anyone wonder.

so, i am powering laser with d9 output and my problem is sometimes it's not deactivates. gcode generator works like after the last point of line, turn off laser, move to start of new line, turn on laser, and i couldn't point a problem on gcode, example gcode is attached aswell.

what is the problem here? is it my gcode writing logic? or there is a trick like i need to add delay between those lines? anyone have any idea?

thanks in adv
Attachments:
open | download - gcode.gh (77.1 KB)
open | download - example.gcode (349.6 KB)
Re: can't read all gcode lines or what?
September 15, 2016 01:19PM
The mosfet output switches the negative side. Most lasers expect the positive side to be switched.

Look in [forums.reprap.org]
Re: can't read all gcode lines or what?
September 15, 2016 01:35PM
Quote
stephenrc
The mosfet output switches the negative side. Most lasers expect the positive side to be switched.

Look in [forums.reprap.org]

well, i don't really get what you mean but it works fine. but on some drawings (which have lots of short curves) it's like forgetting turning off d9 output while traveling from 1 line to another.
Re: can't read all gcode lines or what?
September 19, 2016 05:09PM
no idea anyone? here is a simpler way to ask;

there is "M106 S0" commands in my gcode but marlin reads some of them and reads not some of them. what is problem here?
Re: can't read all gcode lines or what?
September 19, 2016 11:21PM
M106 isn't synchronised with the stepper. Add a G4 P0 before each M106.


Triffid Hunter's Calibration Guide --> X <-- Drill for new Monitor Most important Gcode.
Re: can't read all gcode lines or what?
September 20, 2016 12:00AM
I can see no problem with the M106 command but it may be that you are overloading your cpu with your code.

The following code:
G1 X-6.65 Y2.73 Z100.00 F1000
G1 X-6.66 Y2.23 Z100.00 F1000
G1 X-6.66 Y1.73 Z100.00 F1000
G1 X-6.66 Y1.55 Z100.00 F1000

can be changed to:
G1 X-6.65 Y2.73 -> eliminate Z and F as they have not changed
G1 X-6.66 Y2.23
G1 Y1.73 -> eliminate X as it did not change -> this line could also be deleted as next X is also the same so is a vertical line
G1 Y1.55

Each value that is on line needs to be read ,changed to value from text, and compared to existing value.
This becomes more impotant with several small moves in a row and faster speeds

George.
Re: can't read all gcode lines or what?
September 20, 2016 01:20AM
Quote
george4657
I can see no problem with the M106 command but it may be that you are overloading your cpu with your code.

The M106 code is executed immediately. There is no "overload".


Triffid Hunter's Calibration Guide --> X <-- Drill for new Monitor Most important Gcode.
Re: can't read all gcode lines or what?
September 20, 2016 12:49PM
I did not mean the M106 command was overloading the cpu but that the code for generating the lines is very inefficient.
For example at end of sample it takes 144 lines of code with set Z and feed rate on every line that could be sent in 4 lines of code..
Re: can't read all gcode lines or what?
September 20, 2016 01:40PM
I know what you've mean. Anyhow, the M106 is executed as fast as possible and not waiting for any movement. When you have a file only with

G1 X100 F10
M106 S255

The M106 is executed before! G1 ends.


Triffid Hunter's Calibration Guide --> X <-- Drill for new Monitor Most important Gcode.
Re: can't read all gcode lines or what?
September 20, 2016 03:46PM
Quote
Wurstnase
M106 isn't synchronized with the stepper. Add a G4 P0 before each M106.

thanks, I'll try that as soon as possible, i didn't know it is not synchronized with steppers, if so that should fix the problem.

Quote
george4657
I can see no problem with the M106 command but it may be that you are overloading your cpu with your code.

The following code:
G1 X-6.65 Y2.73 Z100.00 F1000
G1 X-6.66 Y2.23 Z100.00 F1000
G1 X-6.66 Y1.73 Z100.00 F1000
G1 X-6.66 Y1.55 Z100.00 F1000

can be changed to:
G1 X-6.65 Y2.73 -> eliminate Z and F as they have not changed
G1 X-6.66 Y2.23
G1 Y1.73 -> eliminate X as it did not change -> this line could also be deleted as next X is also the same so is a vertical line
G1 Y1.55

Each value that is on line needs to be read ,changed to value from text, and compared to existing value.
This becomes more important with several small moves in a row and faster speeds

George.

even if that's not the problem, you're right it wold be better that way. i just don't know how to do that, need to spend some time to make grasshopper write gcodes that way, it's on my list, I'll do that when i got time, thanks.

edit: G4 P0 made it work good.

Edited 1 time(s). Last edit at 09/20/2016 11:30PM by okuzster.
Re: can't read all gcode lines or what?
September 20, 2016 11:47PM
another thing; i am putting auto home (G28) at the end but it doesn't work neither, i thought "G4 P0" would fix that also but seems not. it doesn't change much thing for me but still wonder why.
Re: can't read all gcode lines or what?
September 21, 2016 01:21AM
Which firmware do you have?


Triffid Hunter's Calibration Guide --> X <-- Drill for new Monitor Most important Gcode.
Re: can't read all gcode lines or what?
September 21, 2016 01:24AM
it's Marlin RC7. G28 on the first line works but not the one at the end.
Re: can't read all gcode lines or what?
September 21, 2016 09:02AM
Do you have a minimal gcode example where all the issues happened?


Triffid Hunter's Calibration Guide --> X <-- Drill for new Monitor Most important Gcode.
Re: can't read all gcode lines or what?
September 21, 2016 04:06PM
Quote
Wurstnase
Do you have a minimal gcode example where all the issues happened?


G4 P0
G28
G1 X14.67 Y5.88 Z98.00 F4000
G4 P0
M106 S255
G1 X14.80 Y5.40 Z98.00 F2000
G1 X14.93 Y4.91 Z98.00 F2000
G1 X15.06 Y4.43 Z98.00 F2000
G1 X15.19 Y3.95 Z98.00 F2000
G1 X15.32 Y3.47 Z98.00 F2000
G1 X15.45 Y2.98 Z98.00 F2000
G1 X15.46 Y2.93 Z98.00 F2000
G4 P0
M106 S0
G1 X-1.45 Y-0.59 Z98.00 F4000
G4 P0
M106 S255
G1 X-1.22 Y-0.15 Z98.00 F2000
G1 X-0.98 Y0.29 Z98.00 F2000
G1 X-0.74 Y0.73 Z98.00 F2000
G1 X-0.51 Y1.17 Z98.00 F2000
G1 X-0.27 Y1.61 Z98.00 F2000
G1 X-0.04 Y2.05 Z98.00 F2000
G1 X0.20 Y2.49 Z98.00 F2000
G1 X0.25 Y2.59 Z98.00 F2000
G4 P0
M106 S0
G4 P0
G28

it goes home, goes start of line1, activate d9, goes end of line1, deactivate d9, goes start of line2, activate d9, goes end of line2, deactivate d9 and stops
Re: can't read all gcode lines or what?
September 22, 2016 03:49AM
I'm a bit confused with your description.

G28 ;home
G4 P0 ;wait until home is done
M106 S255 ;activate D9
G1 X100 F1000 ;move
G4 P0 ;wait until move is done
M106 S0 ;deactivate D9
G28 ;home again

Does this code work like the comments said?


Triffid Hunter's Calibration Guide --> X <-- Drill for new Monitor Most important Gcode.
Re: can't read all gcode lines or what?
September 22, 2016 04:12AM
as you said till last line. it is not going home at the end.

it is no big deal since new code will be start with home again, but i am wondering what causes that.
Re: can't read all gcode lines or what?
September 22, 2016 04:31AM
This is strange. You should open an issue on GitHub.


Triffid Hunter's Calibration Guide --> X <-- Drill for new Monitor Most important Gcode.
Re: can't read all gcode lines or what?
September 22, 2016 09:49AM
i'll and post the result here.
Re: can't read all gcode lines or what?
September 29, 2016 01:23PM
it's working now, i messed with gcode generator a bit but output is still looks same, still don't know what was the problem.
Sorry, only registered users may post in this forum.

Click here to login