0

Hello I'm having a problem with the sequence order of events. I am under the impression that g-code (or the machine) will wait for each command to complete before moving on to the next command. But I'm not seeing this.

I have a plotter machine that controls a pen. The machine has an X & Y axis. The Pen Up/Down command is controlled by a code M280P0S30/M280P0S0

The pen is going down too early. I can see 2 possible reasons for this:

  1. Perhaps there's some problem here with my code or understanding of what these codes do
G28 X Y     ; Auto-home
G90         ; ABS
G21         ; MM
G1 F3000    ; Speed
M280P0S30   ; Pen up
;;;         Problem occurs here: Pen goes down
G1 X50 Y50  ; Move command  
M280P0S0    ; Pen down  
G4 P50      ; Pause 
G1 X50 Y55  ; Move command
G1...snip.... more move commands

Can anyone tell me if there are any mistakes here?

  • Perhaps the M280 codes do not wait for the G1 codes to complete?
  • Perhaps the G4 code is throwing things off?
  • Perhaps I need a faster/slower speed?
  1. I am wondering if the machine buffers and blocks individually based on the type of codes. (A G1 command would block another G1 command but not a M280 command.)

I'm sending the commands over a serial connection. There are too many commands to send all at once so I introduced a pause between the commands. Is it possible that the machine blocks and buffers per-servo? In pseudo code that looks like:

Wait 1 second
Send g-code command: G28 X Y    ; Auto-home
Wait 1 second
Send g-code command:G90         ; ABS
Wait 1 second
Send g-code command:G21         ; MM
Wait 1 second
Send g-code command:G1 F3000    ; Speed
Wait 1 second
Send g-code command:M280P0S30   ; Pen up
Wait 1 second
(Problem occurs here: Pen goes down)
Send g-code command:G1 X50 Y50  ; Move command  
Wait 1 second
Send g-code command:M280P0S0    ; Pen down  
Wait 1 second
Send g-code command:G4 P50      ; Pause 
Wait 1 second
Send g-code command:G1 X50 Y55  ; Move command

Is it possible that the machine will allow an M280 code to run before a G1 code if the machine is currently busy with an existing G1 code?

user1529413
  • 458
  • 8
  • 19

0 Answers0