Macro B Adjusting Work Offset Program Help
Close
Login to Your Account
Results 1 to 16 of 16
  1. #1
    Join Date
    Oct 2019
    Country
    UNITED STATES
    State/Province
    Illinois
    Posts
    16
    Post Thanks / Like
    Likes (Given)
    7
    Likes (Received)
    1

    Default Macro B Adjusting Work Offset Program Help

    Thank you for taking some time to try and help.

    I am running a Romi M27 Lathe, it has a GE Fanuc Series 21i-TB controller.
    We are running tube stock, cutting 6 parts from the length sticking out of the chuck, then advancing the tube to do it again.

    The program I was given to use runs a single part, has the user adjust the work offset, runs a single part, has the user adjust the work offset, etc.

    I am tryin to use Macro B to get the programming to adjust the work offset after each part, for 6 parts, then set its self back out to the very first starting work offset.

    I use the part counter to set when the program should change the work offset.
    I've successfully wrote and ran another program using the part counter in a similar fashion, so that part should be pretty solid.

    Currently I am getting a G code alarm, 010 Improper G-Code.
    I'll indicate in my program example where the machine stops running the program and pops the alarm at.
    The code that I have come up with is as follows:

    IF[#3902GT6]THEN#3902=6
    IF[#3902LT6]THEN#3902=6
    IF[#3901GT#3902]THEN#3901=0
    #3901=#3901

    IF[#3901EQ0]GOTO20
    IF[#3901GE1]GOTO10

    N10 G90 G10 L2 P1 Z0.0 (This is the line that the machine alarms out at)

    N20 (FACE PART)
    T0202
    G40 G80 G90 G95 G97
    G0 Z0.2
    X7.9
    M3 S300
    G1 Z0.0 F0.025
    X6.0
    G0 Z0.1
    M5
    X18.0
    Z-1.0
    M00

    IF[#3901LE5]GOTO40
    IF[#3901EQ6]GOTO30

    N30 G90 G10 L2 P1 Z0.0

    N40
    M30


    The first time I run the program it works fine, since the indicated line is skipped.
    It's not until the second run through that it alarms out for me.
    The book I am using explaining and teaching Macro B programming told me to use those codes for the input.
    Where G10 is Data Setting, L2 is Work Coordinate Setting, and P1 tells it to set G54.
    It seems like it should work, but something is off. I use the same exact codes the book gives me, so I don't know. I have even tried variations of the L & P, like L0002 & P0001, that didn't work. I have to guess its something dumb with Fanuc where it doesn't know what those codes are or something. It acts like G10 is not a valid code for Data Setting.

    The book that the company has that I got the information from is called: Fanuc CNC Custom Macros by Peter Smid.

    Any help would be greatly appreciated.
    Thank you very much.
    Have a great day.

  2. #2
    Join Date
    Sep 2010
    Location
    Victoria Australia
    Posts
    4,137
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    1756

    Default

    Hello RevHaus,
    The full title of the alarm you're getting is a p/s 010 alarm and simply means that the G Code that has raised the alarm is unusable with your control; your control doesn't have that option.

    Even if your control had the G10 option, the better method, in my opinion, is to write directly to the System Variable for workpiece zero point offset values. System Variables #5221 to #5224 respectively are for the first to fourth axis, G54 workpiece zero point offset value. As you have the User Macro option with your control, that method is available to you.

    Regards,

    Bill

  3. Likes DouglasJRizzo liked this post
  4. #3
    Join Date
    Dec 2013
    Location
    Louisville, KY
    Posts
    14
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    1

    Default

    I see a few points to look at here.

    Try moving your N10 above your G10 line.

    Also it looks to me like you may be more of a mill guy than a lathe guy?

    If that’s really a lathe control, G90 isn’t used for absolute/incremental. Fanuc lathes use U and W for incremental, X and Z are absolute. Also G95 is per rev on a mill but a lathe is G99.

    I suspect the improper G code is due to the G90.

  5. #4
    Join Date
    Sep 2010
    Location
    Victoria Australia
    Posts
    4,137
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    1756

    Default

    Quote Originally Posted by mmeredith0015 View Post
    I see a few points to look at here.

    Try moving your N10 above your G10 line.

    Also it looks to me like you may be more of a mill guy than a lathe guy?

    If that’s really a lathe control, G90 isn’t used for absolute/incremental. Fanuc lathes use U and W for incremental, X and Z are absolute. Also G95 is per rev on a mill but a lathe is G99.

    I suspect the improper G code is due to the G90.
    You may be right, but it would depend on the G Code System, A, B, or C, that is set via parameters for the OP's control. For G90 to be the issue, G Code System A would have to be set. In that case a p/s 010 would be raised by G95 in the G40 G80 G90 G95 G97 Block. The OP says that the program works fine for the first execution; accordingly, the program must have executed the G40 G80 G90 G95 G97 Block without issue.

    To RevHaus
    In your following logic, the IF[#3901GE1]GOTO10 is superfluous
    IF[#3901EQ0]GOTO20
    IF[#3901GE1]GOTO10

    N10 G90 G10 L2 P1 Z0.0 (This is the line that the machine alarms out at)

    and the same goes for IF[#3901EQ6]GOTO30 in the following:
    IF[#3901LE5]GOTO40
    IF[#3901EQ6]GOTO30

    N30 G90 G10 L2 P1 Z0.0

    In each case, if the conditional statements IF[#3901EQ0]GOTO20 and IF[#3901EQ6]GOTO30 don't test true, the program will step onto the next Block and whether that conditional statement tests true or not, the Block following it will be executed; you have no alternate strategy for IF[#3901GE1]GOTO10 and IF[#3901EQ6]GOTO30 not testing true.

    In each case, the following will work the same as your current program:

    IF[#3901EQ0]GOTO20
    G90 G10 L2 P1 Z0.0 (This is the line that the machine alarms out at)
    N20 (FACE PART)

    and

    IF[#3901LE5]GOTO40
    G90 G10 L2 P1 Z0.0
    N40
    M30

    Regards,

    Bill

  6. #5
    Join Date
    Oct 2019
    Country
    RUSSIAN FEDERATION
    Posts
    4
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    0

    Default

    G54 work offset data can be obtained in #5221...#5226 values range. #5222 for Z axis, I believe. Then, we need to store original datum...
    N10 #500=#5222 (OBTAIN ORIGINAL DATUM)

    And finally we need to move it to some value...
    N20 #5222=#5222-10 (NEW VALUE FOR G54 Z)

    In place where you need to return original datum just insert...
    N30 #5222=#500 (GET ORIGINAL DATUM BACK)

  7. #6
    Join Date
    May 2007
    Country
    UNITED STATES
    State/Province
    Massachusetts
    Posts
    933
    Post Thanks / Like
    Likes (Given)
    14
    Likes (Received)
    112

    Default

    Haven't used Fanuc in a while. Do you have to cancel G10 mode with a G11?

  8. #7
    Join Date
    Dec 2013
    Location
    Louisville, KY
    Posts
    14
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    1

    Default

    Yes, good eye! Cancel parameter input with G11.

    OP, try moving the G90 above as well. I also typically use system variables myself but I don’t believe you can fire other commands in conjunction with the G10 line.

    It may help in this instance just to start from that line of code. Remove the N10 and G90 and see if it will take the line without issuing the improper G code alarm. This alarm isn’t related to Marco logic, it’s the syntax of the N10 line.

    Good luck!

  9. #8
    Join Date
    Sep 2010
    Location
    Victoria Australia
    Posts
    4,137
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    1756

    Default

    Quote Originally Posted by mmeredith0015 View Post
    Yes, good eye! Cancel parameter input with G11.
    Yes for Programmable Parameter Entry, but not in the OP's case where Work Offsets are being changed, not parameters. G10 has more than one application. One is for use with Work and Tool Offsets, another for Programmable Parameter Entry and another if the control is equipped with Tool Life Management. Its with its use with Programmable Parameter Entry and Tool Life Management where G11 is used to execute Programmable Parameter Entry and Tool Life Management mode cancel, but definitely not required when used to edit Work and Tool Offsets.

    Programmable Parameter Entry mode is initiated by the following Block Syntax:

    G10L50

    The OP is using G10 for Workshift Offset editing; accordingly, G11 is not required.

  10. #9
    Join Date
    Dec 2018
    Country
    UNITED STATES
    State/Province
    Pennsylvania
    Posts
    222
    Post Thanks / Like
    Likes (Given)
    563
    Likes (Received)
    57

    Default

    Quote Originally Posted by beege View Post
    Haven't used Fanuc in a while. Do you have to cancel G10 mode with a G11?
    Only if you are changing a parameter. Anything G10 L50 blah blah blah needs a G11 to cancel after.
    G11 not needed if you are simply changing workshift or any of the work coordinate systems.

  11. #10
    Join Date
    Sep 2010
    Location
    Victoria Australia
    Posts
    4,137
    Post Thanks / Like
    Likes (Given)
    0
    Likes (Received)
    1756

    Default

    Quote Originally Posted by mmeredith0015 View Post
    Yes, good eye! Cancel parameter input with G11.

    OP, try moving the G90 above as well. I also typically use system variables myself but I don’t believe you can fire other commands in conjunction with the G10 line.

    It may help in this instance just to start from that line of code. Remove the N10 and G90 and see if it will take the line without issuing the improper G code alarm. This alarm isn’t related to Marco logic, it’s the syntax of the N10 line.

    Good luck!
    What other commands do you think are being used in conjunction with the N10 Block? If the OP's control is configured to use G Code System "B" or "C", there is zero wrong with the syntax of that block. G10 is a Group 00 G Code and G90 a Group 03 code; accordingly there is absolutely nothing wrong with combining those G codes in the one Block. There is also no problem in having a sequence number on a G10 Block.

    I suspect that the OP's control is configured to use G Code System B, in which case G90 is a legal command with the way the OP's is using it with G10. As I mentioned in an earlier Post, if the OP's control is configured to use G Code System A, which would make the use of G90 wrong in the OP's example, his program would have raised a p/s 010 alarm for the use of G95 in the G40 G80 G90 G95 G97 Block, as there is no G95 in G Code System A.

    Quote Originally Posted by mmeredith0015 View Post
    I suspect the improper G code is due to the G90.
    G90 is an included G Code in all three G Code Systems (A,B and C), but for different uses in System A and B/C. Therefore, irrespective of the G Code System the control is configured to, G90 would not raise a p/s 010, but other p/s alarms would be raised if G90 were to be used as in the OP's program and his control was configured to use G Code System A.

  12. #11
    Join Date
    Jan 2019
    Country
    UNITED STATES
    State/Province
    Missouri
    Posts
    419
    Post Thanks / Like
    Likes (Given)
    107
    Likes (Received)
    104

    Default

    Not to hijack
    but

    Why cant I write to #7021 and above if I can read from #7001 through 8. Yields alarm 115.

    18i M maybe model B. Its around a ~98-99

    work around is G10L20P3 Y#7002

  13. #12
    Join Date
    Sep 2010
    Location
    india
    Posts
    1,376
    Post Thanks / Like
    Likes (Given)
    75
    Likes (Received)
    263

    Default

    Maybe only one additional WCS is available/purchased.

  14. #13
    Join Date
    Oct 2019
    Country
    UNITED STATES
    State/Province
    Illinois
    Posts
    16
    Post Thanks / Like
    Likes (Given)
    7
    Likes (Received)
    1

    Default

    Quote Originally Posted by mmeredith0015 View Post
    I see a few points to look at here.

    Try moving your N10 above your G10 line.

    Also it looks to me like you may be more of a mill guy than a lathe guy?

    I suspect the improper G code is due to the G90.
    I did start out working mills.
    That being said, aside from where the error in the code shows up, the G90 and G95 codes work fine as written. That is the standard safety line that I was given to use in my programming and it never pops any alarms, and it always works. We occasionally swap incremental for absolute and back again, and the code works just fine the way I have it.

    I do absolutely appreciate your help though. I will try some of the things that you pointed out though.
    Thank you very much.

  15. #14
    Join Date
    Oct 2019
    Country
    UNITED STATES
    State/Province
    Illinois
    Posts
    16
    Post Thanks / Like
    Likes (Given)
    7
    Likes (Received)
    1

    Default

    Thank you.
    I will try this and see if I can get it to work.

  16. #15
    Join Date
    Oct 2019
    Country
    UNITED STATES
    State/Province
    Illinois
    Posts
    16
    Post Thanks / Like
    Likes (Given)
    7
    Likes (Received)
    1

    Default

    Thank you.
    I will work with this and see if I can get the program to work.

  17. #16
    Join Date
    Oct 2019
    Country
    UNITED STATES
    State/Province
    Illinois
    Posts
    16
    Post Thanks / Like
    Likes (Given)
    7
    Likes (Received)
    1

    Default

    Thanks for the help.
    I'll see if this helps make the program work.
    I will share my end results if I get it running, or if I move the error to a different line. haha


Tags for this Thread

Bookmarks

Posting Permissions

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