585,962 active members*
3,640 visitors online*
Register for free
Login
IndustryArena Forum > MetalWorking Machines > Haas Machines > Haas Mills > Macros - Checking skip input not working...
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2005
    Posts
    207

    Macros - Checking skip input not working...

    Can someone take a look at this that knows macros.. Having a hell of a time getting this to check to see if my probe is off. Basically it uses a M code relay that will turn it on or off. I want it to turn it off and make sure its off (#1029 skip) before continuing. It will try 4 times before throwing an error. With this code it will finish without error even if it turns the probe back on. It appears as if I cannot use a IF statement to read a changing variable. It outputs what the value was when the start button is pressed.

    Code:
    %
    O09833 (REN MP700 OFF) 
    G103 P1 (LOOK AHEAD ONE BLOCK)
    #3001= 0 
    G04 P250 
    G04 P1 
    G04 P1 
    G04 P1 
    G04 P1 
    G04 P1 
    G04 P1 
    IF [ #3001 LT 200 ] GOTO999 
    N2 
    #4= 0 
    N3 
    M63 (RESET M RELAY)  
    G04 P200 
    #4= #4 + 1 (TRY TURN OFF 4 TIMES) 
    IF [ #4 EQ 4 ] GOTO4 
    M63 (RESET M RELAY) 
    G04 P200 
    M53 (M CODE TO SWITCH OFF PROBE) 
    #3001= 0 (RESET MS TIMER) 
    WH [ #1029 NE 1 ] DO1 (WAIT FOR MP700 OFF) 
    IF [ #3001 GT 3000. ] GOTO3 (MP700 FAIL TO TURN OFF AFTER 3 SEC TRY AGAIN) 
    END1 
    GOTO999 
    N4 
    #3000= 101 (TURN OFF PROBE FAILURE)  
    N999 
    G103 (DISABLE LOOK AHEAD)
    M99 (RETURN) 
    %

  2. #2
    Join Date
    Jul 2005
    Posts
    207
    Bueller?...Bueller?...Bueller?... anyone?:wave:

  3. #3
    Join Date
    Feb 2010
    Posts
    1184
    I am not an expert by any means, but I will give it a shot. My apologies if I am way off.

    ----------------

    M63 (RESET M RELAY)
    G04 P200
    M53 (M CODE TO SWITCH OFF PROBE)

    #3001= 0 (RESET MS TIMER)
    WH [ #1029 NE 1 ] DO1 (WAIT FOR MP700 OFF)
    IF [ #3001 GT 3000. ] GOTO3 (MP700 FAIL TO TURN OFF AFTER 3 SEC TRY AGAIN)
    END1
    GOTO999
    N4
    #3000= 101 (TURN OFF PROBE FAILURE)
    N999
    G103 (DISABLE LOOK AHEAD)
    M99 (RETURN)
    %
    ------------------------
    For the Red line, does #3001 even have a chance to become GT 3000? If not, it will always jump to N999 and end without alarm.

    On another note regarding the Blue lines, arent you turning the probe off then back on with the M53? Your comment line at the M53 says your are switching the probe off but the M53 code turns it on.

    Not sure if this has helped any.
    Good luck!

  4. #4
    Join Date
    Jul 2005
    Posts
    207
    haastec, first let me say thanks for taking your time to help me. Let me walk through these and maybe it will help...

    "For the Red line, does #3001 even have a chance to become GT 3000? If not, it will always jump to N999 and end without alarm."

    This seams to work fine on turning it on... just cant make it turn it off by switching the bit on the 1029 check.

    "On another note regarding the Blue lines, arent you turning the probe off then back on with the M53? Your comment line at the M53 says your are switching the probe off but the M53 code turns it on."


    The probe system turns on with a momentary input. It turns off the same way. This requires the m code relay to be off.. turn on for a second or two and then turn off. This will turn the probe on if it in the off state or turn it off if its in the on state.

  5. #5
    Join Date
    Jan 2011
    Posts
    0

    turning off probe

    I think I see a problem with the way you are writing macros.
    There is a peculair effect when mixing macro variable references and normal G code.
    The macro variable references are all executed frist due to look-ahead.
    While the first dwell G04 is running, up to 80 lines after that will be pre-fetched and all macro lines will be executed.
    There are a couple of fixes to this.
    The easiest is to turn off look-ahead with: "G103 P1".
    Make sure you turn it back on with: "G103" before you go back to normal codes.

  6. #6
    Join Date
    Jul 2005
    Posts
    207
    Look at line 2 and the 2nd from the last line of the code. I did try that and to my hopes that wasn't it Also it seams as if I cannot make a IF statement work that way as well. Seams like it uses the value that is present at the start of the macro. If the value changes in the macro it still uses the old value. Is this the way its supposed to work? Would be very easy to just use a bunch of IFs to make this work but it wont.

    Quote Originally Posted by Wizzard of H View Post
    I think I see a problem with the way you are writing macros.
    There is a peculair effect when mixing macro variable references and normal G code.
    The macro variable references are all executed frist due to look-ahead.
    While the first dwell G04 is running, up to 80 lines after that will be pre-fetched and all macro lines will be executed.
    There are a couple of fixes to this.
    The easiest is to turn off look-ahead with: "G103 P1".
    Make sure you turn it back on with: "G103" before you go back to normal codes.

  7. #7
    Join Date
    Jul 2005
    Posts
    207
    This is how I would rather do the code. It also will not work.

    Code:
    %
    O09833 (REN MP700 OFF) 
    G103 P1 (LOOK AHEAD ONE BLOCK) 
    IF [ #1029 NE 1 ] GOTO999 
    N2 
    #4= 0 
    N3 
    M63 (RESET M RELAY)  
    G04 P200 
    #4= #4 + 1 (TRY TURN OFF 4 TIMES) 
    IF [ #4 EQ 4 ] GOTO4 
    M63 (RESET M RELAY) 
    G04 P100 
    M53 (M CODE TO SEND START SIGNAL TO SWITCH OFF PROBE)
    G04 P100  
    IF [ #1029 NE 1 ] GOTO3 (TEST FOR MP700 OFF)  
    GOTO999 
    N4 
    #3000= 101 (TURN OFF PROBE FAILURE)  
    N999 
    M63 (RESET M RELAY)
    G103 (DISABLE LOOK AHEAD)
    M99 (RETURN) 
    %

Similar Threads

  1. New skip in the house
    By latheboy in forum Community Club House
    Replies: 4
    Last Post: 08-20-2011, 05:30 AM
  2. G540 input 1 not working !
    By Action-KAT in forum Gecko Drives
    Replies: 0
    Last Post: 05-12-2011, 07:08 PM
  3. RS232 DNC input not working
    By dingo0722 in forum Haas Mills
    Replies: 19
    Last Post: 12-11-2010, 01:48 AM
  4. Working on Design - Looking for Input
    By Jesse B in forum DIY CNC Router Table Machines
    Replies: 68
    Last Post: 03-24-2010, 04:55 AM
  5. G540 input not working?
    By stoneyreef in forum Gecko Drives
    Replies: 1
    Last Post: 05-08-2009, 07:52 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
  •