Results 1 to 8 of 8

Thread: Help from macro programmers

  1. #1
    Registered
    Join Date
    Feb 2010
    Location
    USA
    Posts
    691
    Downloads
    0
    Uploads
    0

    Help from macro programmers

    #3011 is where the current date is stored in the machine.
    Ex: #3011=120117 (today's date)

    I want to be able to seperate the contents of #3011 into 3 seperate registers so that the year, month, and day can be read individually for any given day.

    ie:
    #100 = 12 (Year)
    #101 = 01 (Month)
    #102 = 17 (Day)

    I am pretty sure this can be done, but I am fairly weak on advanced macro statements. I may be wrong though.

    Any takers?
    Thanks!


  2. #2
    Registered
    Join Date
    Feb 2009
    Location
    Engerland
    Posts
    22
    Downloads
    0
    Uploads
    0
    Hi Hasstec
    My info tells me my date in #3011 is stored as 20120117 (not 120117) so i have worked on that.
    Not sure how the hass needs to see the syntax of brackets but ..........
    Try this

    #100=FIX[#3011/10000.] (YEAR 2012)
    #101=FIX[[[#3011/10000.]-#100]*100.] (MONTH 01)
    #102=FIX[[[[[[#3011/10000.]-#100]*100.]-#101]*100.] (DAY 17)
    Last edited by jay4389; 01-17-2012 at 04:27 PM. Reason: decimal points missing


  3. #3
    Registered KenFoulks's Avatar
    Join Date
    Aug 2010
    Location
    USA
    Posts
    569
    Downloads
    0
    Uploads
    0
    Here is an engraving macro that separates the date and time out:

    (ENGRAVE DATE)
    G90 X0 Y-1.2
    #100= FIX[ #3011 / 10000 ]
    (MONTH)
    #101= FIX[ #3011 / 100 ] - [ #100 * 100 ]
    (DAY)
    #102= #3011 - [ #100 * 10000 ] - [ #101 * 100 ]
    #599= #101
    G47 P1 (##/) I0. J0.125 R-0.325 Z-0.365 F100. E50.
    #599= #102
    G47 P1 (##/) I0. J0.125 R-0.325 Z-0.365
    #599= #100
    G47 P1 (##) I0. J0.125 R-0.325 Z-0.365

    (ENDGRAVE TIME)
    G90 X0 Y-1.4
    (HOURS)
    #100= FIX[ #3012 / 10000 ]
    (MINUTES)
    #101= FIX[ #3012 / 100 ] - [ #100 * 100 ]
    (SECONDS)
    #102= #3012 - [ #100 * 10000 ] - [ #101 * 100 ]
    #599= #100
    G01 F254.
    G47 P1 ( ##:) I0. J0.125 R-0.325 Z-0.365 F100. E50.
    #599= #101
    G47 P1 (##:) I0. J0.125 R-0.325 Z-0.365
    #599= #102
    G47 P1 (##) I0. J0.125 R-0.325 Z-0.365
    G00 G91 G28 Z0
    Thanks,
    Ken Foulks


  4. #4
    Registered
    Join Date
    Feb 2010
    Location
    USA
    Posts
    691
    Downloads
    0
    Uploads
    0
    Thanks jay4389 and Ken for the help. Engraving is what I am looking to do, so I will give that a try Ken.

    Thanks again!


  • #5
    Registered
    Join Date
    Feb 2010
    Location
    USA
    Posts
    691
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by KenFoulks View Post
    #599= #101
    G47 P1 (##/) I0. J0.125 R-0.325 Z-0.365 F100. E50.
    Ken, I follow everything in the code you provided and it works just like I need it to, but the only thing I am unclear on is how the information in #599 is moved to the G47 line at (##). Is this just a special feature of the #599? Macro majic?

    It obviously works, but I am just trying to understand the code better.

    Thanks!


  • #6
    Registered KenFoulks's Avatar
    Join Date
    Aug 2010
    Location
    USA
    Posts
    569
    Downloads
    0
    Uploads
    0
    It is very much macro magic. Variable 599 is tied to G47. Here is a manual excerpt:

    The initial serial number can also be set manually into a macro variable. The Macros option does not have to be enabled to do this. Macro variable #599 is used to hold the initial serial number to be engraved. For example, when macro variable #599 is set to “1234,” G47 P1 (####), will produce, 1234.
    Thanks,
    Ken Foulks


  • #7
    Registered KenFoulks's Avatar
    Join Date
    Aug 2010
    Location
    USA
    Posts
    569
    Downloads
    0
    Uploads
    0
    You can also read this Answer Man article:

    Engraving Sequential Serial Numbers | Haas
    Thanks,
    Ken Foulks


  • #8
    Registered
    Join Date
    Feb 2010
    Location
    USA
    Posts
    691
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by KenFoulks View Post
    It is very much macro magic. Variable 599 is tied to G47. Here is a manual excerpt:

    The initial serial number can also be set manually into a macro variable. The Macros option does not have to be enabled to do this. Macro variable #599 is used to hold the initial serial number to be engraved. For example, when macro variable #599 is set to “1234,” G47 P1 (####), will produce, 1234.
    I guess I could have read the manual! That makes sense though.

    Thanks again!


  • Similar Threads

    1. CNC programmers/ machininsit iun SE USA
      By BILL WRIGHT CCR in forum Employment Opportunity
      Replies: 0
      Last Post: 02-20-2011, 02:11 PM
    2. Replies: 2
      Last Post: 03-27-2009, 04:15 PM
    3. Convert Fanuc Macro to Fadal Macro
      By bfoster59 in forum Fadal
      Replies: 1
      Last Post: 11-09-2007, 12:41 AM
    4. QBASIC programmers - need help!
      By jderou in forum General CAM Discussion
      Replies: 7
      Last Post: 08-15-2005, 09:15 AM

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.