Why in home XY different G1 is not execute in my code?



  • ; Why in home XY different G1 is not execute in my code?

    ; Duet2 Firmware v2.03 Cartesian CNC
    G90
    M669 K0
    M453 S0
    M550 P"CBeam"
    M586 P0 S1
    M586 P1 S0
    M586 P2 S0
    M569 P0 S1
    M569 P1 S1
    M569 P2 S1
    M584 X0 Y1 Z2
    M350 X16 Y16 Z16 I1
    M92X800.0 Y800.0 Z800.0 ;400step/rev
    M566 X300.0 Y300.0 Z300.0
    M203 X2000.0 Y2000.0 Z2000.0
    M201 X150.0 Y150.0 Z150.0
    M906 X800 Y800 Z800 I30
    M579 X0.988 Y0.988 Z0.988
    M84 S10
    M18
    M208 X0:280 Y0:347 Z0:137
    M564 S1 H1
    M574 X2 Y2 Z2 S0
    M558 P0 H5 F120 T2160
    M140 H-1
    M563 P0
    M911 S21.0 R23.0 P"G91G1Z3F1000"
    ; homex
    G91
    G21
    G1 Z20 H1 F500
    G1 X-300 H1 F1800
    G1 X5 F300
    G1 X-10 H1 F300 ;this is not execute?
    G1 Z-20 H1 F500 ;this is not execute?
    G92 X0
    G90
    ; homey
    G91
    G21
    G1 Z20 H1 F500
    G1 Y-360 H1 F1800
    G1 Y9 F300
    G1 Y-10 H1 F300 ;this is not execute?
    G1 Z-20 H1 F500 ;this is not execute?
    G92 Y0
    G90
    ; homez
    G91
    G21
    G1 Z180 H1 F1800
    G1 Z-5 F300
    G1 Z9 H1 F300
    G1 Z-120 F1400
    G92 Z-120
    G90
    ; homeall
    G91
    G21
    G1 Z170 H1 F1800
    G1 Z-5 F300
    G1 Z9 H1 F300
    G1 X-300 Y-360 H1 F1800
    G1 X-5 Y-5 F300
    G1 X10 Y10 H1 F300
    G1 Z-120 F1400
    G92 X0 Y0 Z-120
    G90



  • @Clement-B said in Why in home XY different G1 is not execute in my code?:

    ; homex
    G91
    G21
    G1 Z20 H1 F500
    G1 X-300 H1 F1800
    G1 X5 F300
    G1 X-10 H1 F300 ;this is not execute?
    G1 Z-20 H1 F500 ;this is not execute?
    G92 X0
    G90

    It seems rather odd that you have endstop/probe moves for Z in your homeX. Perhaps the Z moves do not need the H1?

    Using dashboard "homex" button, or G28 X command, does the X axis show as homed after all this executes?



  • G1 Y-10 H1 F300 ;this is not execute?
    G1 Z-20 H1 F500 ;this is not execute?
    

    that would be because Y and Z are already at the limit switch presumably? or you need to reverse the sign due to relative moves?


  • Moderator

    @Clement-B said in Why in home XY different G1 is not execute in my code?:

    M92X800.0 Y800.0 Z800.0 ;400step/rev

    You appear to be missing a space after M92



  • You appear to be missing a space after M92

    Thank for your answer, but
    Are spaces required between commands?
    This is a question.



  • @Clement-B said in Why in home XY different G1 is not execute in my code?:

    Are spaces required between commands?

    It certainly isn't for all commands, but it does aid readability and doesn't hurt.



  • Spaces are not required between coordinates. X0Y0 or X0 Y0 is fine.

    Spaces are not technically required anywhere per the NIST standard, and similarly not required by the Duet parser.

    However, it is a very strong best practice to have one in between the "command word" that begins the line and everything else on the line.



  • @Danal said in Why in home XY different G1 is not execute in my code?:

    Using dashboard "homex" button, or G28 X command, does the X axis show as homed after all this executes?

    Using dashboard "homex" button, or G28 X command, does the X axis show as homed after all this executes?

    I use DuetPanel,
    Control | I execute "homex.g" . The command G1 X-10 and G1 Z-20 is not execute, but for Z this not in the limit place?

    G1 X-10 H1 F300
    G1 Z-20 H1 F500

    With command G28 X, this work correctly.



  • @Danal

    Thank for your info



  • Just as a future note:

    Running the macro as a macro IS NOT the same as having the macro invoked via G28 or a DWC "home" button.

    Having it auto invoked by G28 or home button will mark X as "homed". Running as a 'regular' macro will not. There may be other more subtle differences.



  • @Danal

    Thank for this info



  • @Danal

    Here, I don't use macro file but the button homeX which calls the "homex.g" file,
    I apologize for not being clear enough.



  • Perfect, that is the right way.

    Votre langue maternelle est-elle française?


  • administrators

    @Danal said in Why in home XY different G1 is not execute in my code?:

    Spaces are not required between coordinates. X0Y0 or X0 Y0 is fine.

    Correct; except that a space is needed before an E parameter. Otherwise the E gets taken as an exponent for the previous number. Example:

    M98 Z400 E100 ; Z steps/mm is 400, E steps/mm is 100
    M98 Z400E100  ; Z steps/mm is 400 * 10^100


  • @Danal

    Oui



  • @dc42

    Thank for this info



  • I think I don't understand the M208 command well.
    I think the commands in homex and homey are due to my misunderstanding of M208 ... G92
    There are a few things that I don't quite understand.

    The lengths of the axes of my CNC are: X = 280 Y = 347 Z = 137mm

    For the LSW to be touched by the Z axis by command G1 Z180 H1 F1800.
                                     X G1 X-300 H1 F1800.
                                     Y G1 Y-360 H1 F1800.
    After these 3 commands, my router is at the left limit on the X axis (at the X- limit)
                                                base limit on the Y axis (at the Y- limit)
                                                high limit on the Z axis (at the Z + limit)

    I want my Home position to be there for the X and Y axes.
    But for Z, I want the position to be 120mm below the Z limit. So Z-120mm.

    I want my movements work only within the limits of my CNC.

    How I write this in Gcode in my config.g and home_.g files

    And then, if possible, translate my RRF2.03 version into RRF3 version.

    ;============================================================
    ;============================================================
    ;============================================================

    ; This my code + commentary *****************************************************************

    ; Duet2 Firmware RRF2.03
    ; ---Generales---
    G90 ; Absolue (A space is needed before an E parameter)
    M669 K0 ; Knnn Kinematics type: 0=Cartesian
    M453 S0 ; S0=CNC S0=default spindle (S0-S3 spindle max)... Here: M3/M4/M5 control the pins defined for the milling device
    ; ---Network---
    M550 P"CBeam" ; Machine name
    M551 P" " ; Set password
    M552 S1 P172.16.1.74 ; S1=Enable network -> Ethernet - Change IP Address to suit
    M586 P0 S1 ; Enable HTTP S1=enable
    M586 P1 S0 ; Disable FTP
    M586 P2 S0 ; Disable Telnet
    M540 PBE:64:4B:54:52:5C ; MAC Address (Use when more 1 duet on the same network). Change only last byte: 00..FF BE:64:4B:54:52:5C -> 172.16.1.74
    ; ---Drives---
    M569 P0 S1 ; Drive P0.1 DIR: S0=Backwards - S1=Forwards +
    M569 P1 S1 ; Drive P0.2
    M569 P2 S1 ; Drive P0.3 Zdn=- Zup=+
    M584 X0 Y1 Z2 ; Associer Driver & Axe
    ; ---Axis_Config---
    M350 X16 Y16 Z16 I1 ; Microstepping (16=with interpolation)
    ; C_Beam -> leadscreew=diameter=8mm, pitch=2mm. 8mm!=diameter->(8mm/rev)/pitch=4starts 4starts=kind of screw
    M92 X800.00 Y800.00 Z800.00 ; steps/mm 0.9degre/step=400step/rev 400*16ustep=6400 6400/4=800step/mm
    M566 X300.00 Y300.00 Z300.00 ; Speed change 500mm/min Speed start at 300 = minimum speed
    M203 X2000.00 Y2000.00 Z2000.00 ; Speed max <-G0 2520mm/min
    M201 X150.00 Y150.00 Z150.00 ; Acceleration 150mm/s^2
    M906 X800 Y800 Z800 I30 ; 2400mA max, 800mA/bobine & motor idle 30%) StepMotor: JUGETEK_57H56M-2804A=1.68A(85%=good) 0.9degre 1.2N.m Nema23
    ;M906 X2400 Y2400 Z2400 I100 ; Current https://blog.prusaprinters.org/calculator/
    M84 S10 ; Idle->I30 After 10sec of inactivity -> current 30%
    ;M579 X0.988 Y0.988 Z0.988 ; Calibration 300mm=demand size/303.6mm=reel size -> M579 Cartesian mode
    M18 ; Motor->OFF G0-G3 Motor->ON
    ; ---Axis_Limits---
    M208 X0:280 Y0:347 Z0:137 ; Xmin:max X->279.4mm=11" Y->346.075mm=13 5/8" Z->136.525mm=5 3/8"<-CBeam z0->LSW Limit min=S1 max=S0 Zup=+ Zdn=-
    M564 S1 H1 ; S1=use LSW S0=not use LSW H1=set Home before move H0=no set Home
    ; ---Fans---
    ;M950 F0 C"out7" Q500 ; Create fan 0 on pin out7 and set its frequency
    ;M106 P0 S0 H-1 ; Set fan 0 value. Thermostatic control is turned off
    ; ---Endstops---
    M574 X2 Y2 Z2 S0 ; Set active low endstops. X0=none X1=low_end X2=high_end S0=active_LOW_enstop_input S1=active_HIGH_enstop_input
    ; ---Probes---
    M558 P0 H5 F120 T2160 ; P0=no probe. Disable Z probe but set la hauteur de plonger, probe speed & travel speed
    ; ---Heaters---
    M140 H-1 ; Negative value = disable heater_1 bed
    ; ---Lasers---
    ;M452 ; If M452 -> G0 G1:S=0-255 Value power Laser: 0-255
    ; ; H0=no_action H1=LSW+M208->limite H3=LSW+position_axe->limite H2=individuel axe (no_CNC)
    ; ---Tools---
    M563 P0 ; P0= Tool0 Need defind allway
    ;G10 P0 X0 Y0 Z0 ; Set Tool0 axis offsets
    ;G10 P0 R0 S0 ; Set initial Tool0 active and standby temperatures to 0C
    ; ---Others---
    M911 S21.0 R23.0 P"G91 G1 Z3 F1000" ; Save info if power loss. PowerSupply:24V 21V=stop 23V=restart (Z up de 3mm en relatif)
    ;M501 ; Load config-override.g (Stored Parameters)
    ;M98 P"customconfig.g" ; Execute custom config settings

    ;=================================================================================
    ; X->279.4mm=11" Y->346.075mm=13 5/8" Z->136.525mm=5 3/8"<-CBeam X=300 Y=360 Z=150

    ; homex.g
    G91 ; Relative
    G21 ; Units to mm
    G1 Z20 H1 F500 ; Zup (protect break bit)
    G1 X-300 H1 F1800 ; Move to LSW X & stop
    G1 X5 F300 ; Go back for ajuste more precisely X at LSW
    G1 X-10 H1 F300 ; Move to LSW X & stop
    G1 Z-20 H1 F500 ; Zdn
    G90 ; Absolute
    G92 X0 ; Set Home Position

    ; homey.g
    G91 ; Relative
    G21 ; Units to mm
    G1 Z20 H1 F500 ; Zup (protect break bit)
    G1 Y-360 H1 F1800 ; Move to LSW Y & stop
    G1 Y5 F300 ; Go back for ajuste more precisely Y at LSW
    G1 Y-10 H1 F300 ; Move to LSW Y & stop
    G1 Z-20 H1 F500 ; Zdn
    G90 ; Absolute
    G92 Y0 ; Set Home Position

    ; homez.g
    G91 ; Relative
    G21 ; Units to mm
    G1 Z180 H1 F1800 ; Move to LSW Z & stop Zup=+
    G1 Z-5 F300 ; Go back for ajuste precisely at LSW
    G1 Z-120 F1400 ; Go Home
    G90 ; Absolute
    G92 Z-120 ; Set Home Position

    ; homeall.g
    G91 ; Relative
    G21 ; Units to mm
    G1 Z170 H1 F1800 ; Move to LSW Z & stop Zup=+
    G1 Z-5 F300 ; Go back for ajuste precisely at LSW
    G1 Z9 H1 F300 ; Move to LSW Z & stop
    G1 X-300 Y-360 H1 F1800 ; Move to LSW X & stop
    G1 X-5 Y-5 F300 ; Go back for ajuste more precisely X at LSW
    G1 X10 Y10 H1 F300 ; Move to LSW X & stop
    G1 Z-120 F1400 ; Go Home
    G90 ; Absolute
    G92 X0 Y0 Z-120 ; Set Home Position


  • Moderator

    The minima value from M208 is set as the axis position when the endstop is triggered. So in your homex and homeY files you don't need to use the G92 X0 and G92 Y0 because those values are already set as soon as the endstop is triggered.

    For your Z axis, your M208 says the Z minima is 0 and maxima is 137, and then in your homing file you home to z max and the position is set as 137, then you move it down by -120, which would place the Z axis at (137-120=17) and then set the position to be actually as -120, which tells the firmware it's below the minima.

    It's not super clear to me yet from your description what you actually want to happen. Perhaps a picture of the machine marked up with your intention?


  • Moderator

    @Clement-B said in Why in home XY different G1 is not execute in my code?:

    ; homez.g
    G91 ; Relative
    G21 ; Units to mm
    G1 Z180 H1 F1800 ; Move to LSW Z & stop Zup=+
    G1 Z-5 F300 ; Go back for ajuste precisely at LSW
    G1 Z-120 F1400 ; Go Home
    G90 ; Absolute
    G92 Z-120 ; Set Home Position

    Also, your homez file differs from your homeall file. In homez you move to the endstop, back off 5mm, then back off another 120, putting the actual position at -125.

    But in homeall you hit the endstop, back off 5mm, hit the endstop again, and then move down 120. You'll get an unintentionally different position between homez and homeall because of that.



  • @Phaedrux
    ok, I see this,
    thank



  • @Phaedrux

    Hi

    Photo CNC for M208 G92.pdf

    Is-it more clear?


  • Moderator

    @Clement-B said in Why in home XY different G1 is not execute in my code?:

    ; homex.g
    G91 ; Relative
    G21 ; Units to mm
    G1 Z20 H1 F500 ; Zup (protect break bit)
    G1 X-300 H1 F1800 ; Move to LSW X & stop
    G1 X5 F300 ; Go back for ajuste more precisely X at LSW
    G1 X-10 H1 F300 ; Move to LSW X & stop
    G1 Z-20 H1 F500 ; Zdn
    G90 ; Absolute
    G92 X0 ; Set Home Position
    ; homey.g
    G91 ; Relative
    G21 ; Units to mm
    G1 Z20 H1 F500 ; Zup (protect break bit)
    G1 Y-360 H1 F1800 ; Move to LSW Y & stop
    G1 Y5 F300 ; Go back for ajuste more precisely Y at LSW
    G1 Y-10 H1 F300 ; Move to LSW Y & stop
    G1 Z-20 H1 F500 ; Zdn
    G90 ; Absolute
    G92 Y0 ; Set Home Position

    It was mentioned earlier, but I don't think you changed it. The Z moves to raise the bit by 20mm have the H1 switch, which should be H2 instead. H1 is used to seek the endstop, H2 is to allow movement before the axis is homed.

    Since the Z move is so short, it may not hit the endstop and that may be why your other moves are not executing?

    Your photos are very helpful in understanding your setup. I'm not totally sure what else to do. CNC isn't really my wheelhouse. But please try changing H1 to H2 for the Z moves to see if that helps.



  • Thank for your interet for helping me.
    I just changed H1 to H2.
    By your explanation, I understand what H2 is doing.
    But that doesn't solve one of my problems.

    ; The X and Y axes cannot move: example G1 X-30 Y-30. Nothing is moving here?
    ; I suspect M208. I reversed the values, but it doesn't work better?

    ; M208 X-280: 0 Y-347: 0 Z0: 137 ; G1 X-30 Y-30. Nothing is moving here?
    ; or
    ; M208 X0: 280 Y0: 347 Z0: 137 ; G1 X-30 Y-30. Nothing is moving here?
    ; M208 X0: 280 Y0: 347 Z0: 137 ; I think this is the good way, but nothing work?
    ;=============================================================
    ;homex.g
    G91 ; Relative
    G21 ; Units to mm
    G1 Z20 H2 F500 ; Zup (protect break bit) H2 is to allow movement before the axis is homed.
    G1 X-300 H1 F1800 ; Move to LSW X & stop
    G1 X5 F300 ; Go back for ajuste more precisely X at LSW
    G1 X-10 H1 F300 ; Move to LSW X & stop
    G1 Z-20 H2 F500 ; Zdn
    ;G92 X0 ; Don't need, because min M208 set the axis position when the endstop is triggered (click)
    G90 ; Absolute
    ;=============================================================
    ; homey.g
    G91 ; Relative
    G21 ; Units to mm
    G1 Z20 H2 F500 ; Zup (protect break bit) H2 is to allow movement before the axis is homed.
    G1 Y-360 H1 F1800 ; Move to LSW Y & stop
    G1 Y5 F300 ; Go back for ajuste more precisely Y at LSW (Y5 & Y-10)
    G1 Y-10 H1 F300 ; Move to LSW Y & stop
    G1 Z-20 H2 F500 ; Zdn
    ;G92 Y0 ; Don't need, because min M208 set the axis position when the endstop is triggered (click)
    G90 ; Absolute



  • I resolve my problem, Thank you ALL.
    Together we go faster.


  • Moderator

    Glad to hear. What did you change?


Log in to reply