603,810 active members*
2,888 visitors online*
Register for free
Login
IndustryArena Forum > MetalWorking Machines > Tormach Personal CNC Mill > Having problems with g-code sub-routines in PP
Results 1 to 1 of 1
  1. #1
    Join Date
    Aug 2023
    Posts
    1

    Having problems with g-code sub-routines in PP

    Hello all,
    PCNC440 programming question.
    I have a program for doing engine turning on my PCNC440 but it does not to calling and returning from sub's correctly
    I am sure it is right in my face but can't see the forest because of the trees....

    Any hints appreciated
    Thank you,
    Aaron

    #<_x_start> = 0
    #<_y_start> = 0
    #<_x_stepover> = .25
    #<_y_stepover> = .25
    #<_x_distance> = 2.0 (part width in x)
    #<_y_distance> = 2.0 (part depth in y)
    #<_x_repeat_count> = [FUP[#<_x_distance> / #<_x_stepover>]] (FUP will round up to nearest integer value)
    #<_y_repeat_count> = [FUP[#<_y_distance> / #<_y_stepover>]]
    #<_x_retract> = [#<_x_repeat_count> * #<_x_stepover>]
    #<_z_depth> = -.1 (how far to compress the tapping head)
    #<_z_retract> = .2
    #<_dwell> = 1 (how long to dwell in seconds)
    #<_z_feed> = 20
    #<_spindle_rpm> = 2500

    O100 (engine turning sub - handles Z motion and dwell at one X/Y location)
    G1 Z#<_z_depth> F#<_z_feed>
    G4 P#<_dwell>
    G0 Z#<_z_retract>
    M99

    O101 (move over one stepover in X)
    G91 (change to incremental coordinates)
    G0 X#<_x_stepover>
    G90 (back to absolute coordinates)
    M99
    O102 (engine turn one point, then move over one stepover)
    M98 P100
    M98 P101
    M99

    O103 (complete one entire row in X)
    M98 P102 L#<_x_repeat_count>
    G91 (change to incremental coordinates)
    G0 X-#<_x_retract>
    G90 (back to absolute coordinates)
    M99

    O104 (do one X row, then increment Y)
    M98 P103
    G91 Y#<_y_stepover>
    G90
    M99

    O105 (main program)
    G54 G20 G90 (safety block)
    M3 S#<_spindle_rpm> (spindle on)
    G0 X#<_x_start> Y#<_y_start> Z.2
    M98 P104 L#<_y_repeat_count>
    G30 (move to G30 position)
    M30

  2. #2
    Join Date
    Nov 2022
    Posts
    14
    Have you read through this?
    https://tormach.com/subroutines-reference
    At a glance it looks like you done have the sub routine truncated correctly. I haven't done very much with subs FWIW

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •