588,570 active members*
4,936 visitors online*
Register for free
Login
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2005
    Posts
    1

    Number Counter

    Hi guys
    i need your assistance in solving the next issue
    i have to engrave numbers from 1 to 150
    while every part will have the next following number
    i have 10 subroutines witch are the numbers it self
    for example subroutine
    o2500 is for "0"
    o2501 for "1"
    o2502 for "2"
    and so on
    what kind of logical macro should i use to build the
    counter and move in the place of the written number,
    while the right routine number is cold for every place ?

  2. #2
    Join Date
    Dec 2005
    Posts
    3319
    A variation of the IF/THEN/NEXT should do it.

    100 Xold=02500, Yold=0, (set start of count and relationship of X to Y)
    200 Xnew=Xold+1 and Ynew=Yold+1 (update X & Y)
    300 IF Xnew< or = desired count, go to Line 500, else go to Line 200
    500 End

    It might not be exactly what you want but it should turn on the lightbulb.

  3. #3
    Join Date
    Feb 2007
    Posts
    126
    http://www.cncci.com/resources/tips/serial%20macro.htm


    If you want to use your own numbers and they are programmed in absolute, use g52 to shift zero instead of locating at the number center and using incremental numbers as this macro does.

    If you want to make it all one self contained program, use GOTO's to go to the number geometry's and increment a counter within each number to decide where to jump back to.

  4. #4
    Join Date
    Mar 2005
    Posts
    1498
    070901-1523 EST USA

    The following should work on a HAAS but I have not tried it. It would be nice if you could make Z absolute and independently X and Y incremental.

    Create a group of local subroutines that are programmed in incremental within an external subroutine. One internal subroutine for each of the ten digits. Incremental programming for each character starts at the lower left corner of the rectangle allocated for the character. You can make the characters mono-spaced or proportional as you choose by the way you write the incremental code. The ending position of your character is the lower right corner of the above said rectangle.

    Note the ending position of a character is the beginning position of the next character.

    Assumed range is 1 thru 999.

    Let #500 be your serial number counter, initialize this to 1 when you start your serial numbering. This loaded outside of your part program O0700 .

    #500 = 1


    %
    O0700 (your part program)

    (startup stuff)


    #110 = -0.01 ( the absolute depth of engraving cut relative to G5x using G90)
    (assume Z 0 relative to G90 G5x is the surface of your material where engraving is performed)
    #111 = 0.05 (clearance in Z between characters or non-connected strokes)



    (To engrave a serial number

    G5x (G54 thru your maximum --- your choice)
    G90
    G00 X nn.nnnn Y mm.mmmm Z clearance (lower left start position of number)

    #100 = #500/100
    #108 = FIX [#100] (gets the integer value of the hundreds position)
    G65 I#108 P1000 (do 100s digit)

    #101 = #500 - #108*100 (remove the 100s digit)
    #102 = #101/10 (extract the 10s digit)
    #108 = FIX [#102] (")
    G65 I#108 P1000 (do tens digit)

    #103 = #101 - #108*10 (hundreds already removed, remove 10's digit)
    #108 = FIX [#103]
    G65 I#108 P1000 (do units digit)

    (remainder of your program)
    M30

    %


    In your subroutine. You will need to switch between G90 and G91 as required to handle the Z motion.

    %
    O1000 (serial number external subroutine)
    (digit number passed in via I address in G65 of the calling program)
    (#111 and #110 pass in the clearance and depth of cut)

    G90
    G00 Z#111
    G01 Z#110
    G91 (probably put this in the subroutoines instead of here)
    G97 P[100 + #4] (address I in G65 maps to #4 in the called routine)
    G90
    G00 Z#111
    M99 (at X, Y start position of next character because this is end of this character)

    N100
    (incremental code for space)
    M99

    N101
    (incremental code for character 1)
    M99

    (etc)

    %


    See if I made any mistakes. Note: there are many variations on this method. Also you can add tests for bad data but I have not to make the code simple.

    .

Similar Threads

  1. Looking for the the material number details
    By lly1001 in forum Bending, Forging, Extrusion...
    Replies: 1
    Last Post: 06-28-2008, 09:26 AM
  2. counter
    By cncsdr in forum Haas Mills
    Replies: 2
    Last Post: 11-08-2005, 02:56 PM
  3. Dx-32 auto N number for you
    By jtree83 in forum Bridgeport / Hardinge Mills
    Replies: 4
    Last Post: 09-26-2005, 07:28 PM
  4. THK model number question
    By Darren_T in forum DIY CNC Router Table Machines
    Replies: 3
    Last Post: 10-16-2003, 01:33 AM

Posting Permissions

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