586,655 active members*
2,977 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Fanuc > Need help with making indexer macro.
Results 1 to 15 of 15
  1. #1
    Join Date
    Feb 2005
    Posts
    19

    Need help with making indexer macro.

    We have a YCM Supermax 1020xv with a fanuc MXP-200i control. The indexer is a Haas HRT-210. The company has been indexing for years by using only the 4 pin trigger and finish signal relay via M54 code. The problem is, people crash way too much from starting the machine with the indexer on the wrong step number (BOOOOM). I've been doing a lot of reading on controlling the indexer through the rs232 port (also used to send and receive programs). I have successfully configured the fanuc control and haas control parameters to rotate the indexer. I have to have dedicated sub programs for the angle that I want to index to. So, for example, in the program I call a sub that has all of the DPRNT lines (angle, absolute, etc.) to put into the indexer then execute an M54. This is a Pain in the butt because I have to change or create a new sub every time I want a different angle. My next step is to create a macro to allow me to just put the desired angle in the main program (possibly a macro variable IDK). For some reason all of the stuff I read about macro programming doesn't stick. Lol. Thanks in advance for any help.

  2. #2
    Is there a way to send the indexer to a home position before doing a move command?

  3. #3
    Join Date
    Sep 2010
    Posts
    1230
    Quote Originally Posted by unclemike1 View Post
    We have a YCM Supermax 1020xv with a fanuc MXP-200i control. The indexer is a Haas HRT-210. The company has been indexing for years by using only the 4 pin trigger and finish signal relay via M54 code. The problem is, people crash way too much from starting the machine with the indexer on the wrong step number (BOOOOM). I've been doing a lot of reading on controlling the indexer through the rs232 port (also used to send and receive programs). I have successfully configured the fanuc control and haas control parameters to rotate the indexer. I have to have dedicated sub programs for the angle that I want to index to. So, for example, in the program I call a sub that has all of the DPRNT lines (angle, absolute, etc.) to put into the indexer then execute an M54. This is a Pain in the butt because I have to change or create a new sub every time I want a different angle. My next step is to create a macro to allow me to just put the desired angle in the main program (possibly a macro variable IDK). For some reason all of the stuff I read about macro programming doesn't stick. Lol. Thanks in advance for any help.
    Hi Mike,

    The Sub Program that's using the DPRNT function could be called as a Macro Program and passed an Angle argument via the Call Block to the corresponding Local Variable. Arguments can't be passed if the program is called as a Sub. Accordingly, you would call the program with G65, or with a Custom M or G Code.

    If you take the Custom G or M code approach, your Call Block could look something like the following:

    M101 A20.

    In the Macro program, Local Variable #1 would receive the passed argument 20.0 from the Call Statement, where it would be massaged into whatever the format is required for the Indexer, if not able to be output directly as 20.0.

    Regards,

    Bill

  4. #4
    Join Date
    Feb 2005
    Posts
    19
    Quote Originally Posted by angelw View Post
    Hi Mike,

    The Sub Program that's using the DPRNT function could be called as a Macro Program and passed an Angle argument via the Call Block to the corresponding Local Variable. Arguments can't be passed if the program is called as a Sub. Accordingly, you would call the program with G65, or with a Custom M or G Code.

    If you take the Custom G or M code approach, your Call Block could look something like the following:

    M101 A20.

    In the Macro program, Local Variable #1 would receive the passed argument 20.0 from the Call Statement, where it would be massaged into whatever the format is required for the Indexer, if not able to be output directly as 20.0.

    Regards,

    Bill
    Thank you very much for the quick response and help. If possible, could you give me a longer visual example of the lines for the main and the lines for the sub? I hate to be a pain but, once we start talking about variables and arguments, I get lost. I get embarrassed at the fact that I can program some incredible things but just don't understand how macros work. Lol. How would I even assign the custom M or G code? I would like to use the existing M54 to avoid confusion with the other set-up guys. Thanks

  5. #5
    Join Date
    Sep 2010
    Posts
    1230
    Quote Originally Posted by unclemike1 View Post
    Thank you very much for the quick response and help. If possible, could you give me a longer visual example of the lines for the main and the lines for the sub? I hate to be a pain but, once we start talking about variables and arguments, I get lost. I get embarrassed at the fact that I can program some incredible things but just don't understand how macros work. Lol. How would I even assign the custom M or G code? I would like to use the existing M54 to avoid confusion with the other set-up guys. Thanks
    Hi Mike,
    You will have to post what you have in your current Sub Program so I and the Forum can see what the Indexer requires, but basically, you would just output the Angle data as a Local Variable #1, if the "A" address is used for the passed argument.

    What is M54, is that the M code for indexing? If M54 is used in the Macro program, you will also be able to use it to Call the Macro program. You create an "M" code to call a Macro Program by registering the numeric value of the "M" code in a parameter that corresponds to a particular program number. For example, if the number "54" is registered in parameter 6080 of a late model control such as a 21, or late O series control, then Program O9020 will be called when M54 is commanded, either via MDI or in a program. However, if M54 is executed in a Macro Program called by M54, or any other "M" code, then its treated as a normal "M" code in the Macro program. I'm fairly sure that the parameters are the same for your control, but you can confirm this via the Fanuc Operator manual for your machine in the Macro Programming section.

    For the sake of the explanation, lets say that the parameters for registering "M" codes to call Macro Programs is the same as stated above. If "54" is registered in parameter 6080, and "A" is the address character used to pass the angle argument, then the Call Block used each time an index is required will be as follows:

    M54 A30.0

    With "54" registered as a Macro Call "M" code, the above command block will have the same meaning and function as the following:

    G65 P9020 A30.0

    If other arguments have to be passed to the Macro Program, they can be added to the Macro Call Block, and the Macro Program written in such a way as to make use of the arguments being passed.

    If you Post the Sub Program using DPRNT that currently works correctly, I, or someone from the Forum will show you an example of how arguments can be passed to, and used by the Macro program.

    Regards,

    Bill

  6. #6
    unclemike1 Guest
    Quote Originally Posted by angelw View Post
    Hi Mike,
    You will have to post what you have in your current Sub Program so I and the Forum can see what the Indexer requires, but basically, you would just output the Angle data as a Local Variable #1, if the "A" address is used for the passed argument.

    What is M54, is that the M code for indexing? If M54 is used in the Macro program, you will also be able to use it to Call the Macro program. You create an "M" code to call a Macro Program by registering the numeric value of the "M" code in a parameter that corresponds to a particular program number. For example, if the number "54" is registered in parameter 6080 of a late model control such as a 21, or late O series control, then Program O9020 will be called when M54 is commanded, either via MDI or in a program. However, if M54 is executed in a Macro Program called by M54, or any other "M" code, then its treated as a normal "M" code in the Macro program. I'm fairly sure that the parameters are the same for your control, but you can confirm this via the Fanuc Operator manual for your machine in the Macro Programming section.

    For the sake of the explanation, lets say that the parameters for registering "M" codes to call Macro Programs is the same as stated above. If "54" is registered in parameter 6080, and "A" is the address character used to pass the angle argument, then the Call Block used each time an index is required will be as follows:

    M54 A30.0

    With "54" registered as a Macro Call "M" code, the above command block will have the same meaning and function as the following:

    G65 P9020 A30.0

    If other arguments have to be passed to the Macro Program, they can be added to the Macro Call Block, and the Macro Program written in such a way as to make use of the arguments being passed.

    If you Post the Sub Program using DPRNT that currently works correctly, I, or someone from the Forum will show you an example of how arguments can be passed to, and used by the Macro program.

    Regards,

    Bill
    Sorry for the late response, I've knee deep in jobs all day. This is an example of what I have working now.

    In the main:
    M98 P9001 (this the 90.00 degree program)

    In the sub:
    POPEN
    DPRNT [ ]
    G04 P64
    DPRNT [UG090]
    G04 P64
    DPRNT [US090.000]
    G04 P64
    DPRNT [UF060.000]
    G04 P64
    PCLOS
    M54
    M99
    % (Back to the Main)

    I understand about how to assign a program to an M-code but the macro call messes with me. After getting the custom macro variable to work I'm going to dive into the next issue. The fact that I need to use the RS232 for programming the step value to the control box AND the 4 pin relay trigger and finish signal wire at the same time to get the Haas to index bothers me. There has to be a way to use the RS232 to enter the step value and send the start signal and Finish signal all in one wire. But, I guess we will deal with one issue at a time (baby steps). Thanks again Bill, I really appreciate all of the help.

  7. #7
    Join Date
    Feb 2005
    Posts
    19
    I feel abandoned! LOL

  8. #8
    Join Date
    Sep 2010
    Posts
    1230
    Quote Originally Posted by unclemike1 View Post
    Sorry for the late response, I've knee deep in jobs all day. This is an example of what I have working now.

    In the main:
    M98 P9001 (this the 90.00 degree program)

    In the sub:
    POPEN
    DPRNT [ ]
    G04 P64
    DPRNT [UG090]
    G04 P64
    DPRNT [US090.000]
    G04 P64
    DPRNT [UF060.000]
    G04 P64
    PCLOS
    M54
    M99
    % (Back to the Main)

    I understand about how to assign a program to an M-code but the macro call messes with me. After getting the custom macro variable to work I'm going to dive into the next issue. The fact that I need to use the RS232 for programming the step value to the control box AND the 4 pin relay trigger and finish signal wire at the same time to get the Haas to index bothers me. There has to be a way to use the RS232 to enter the step value and send the start signal and Finish signal all in one wire. But, I guess we will deal with one issue at a time (baby steps). Thanks again Bill, I really appreciate all of the help.
    I'm not quite sure what you want to do with regards to the Finish Signal. I assume that M54 is the index command, and that the Indexer must be interfaced with the control in some way. If not, you could wire into one of the Discrete Inputs and the state of the Input variable, #1000-#1063, can be read in the following way

    N10 IF [#1000 EQ 0] GOTO10

    The above block will halt the program until the logic sate of #1000 is "1". The problem with this is that its an endless loop if the state never changes, but many MTB write programs using that type of flow.

    Another way that will allow a timed exit is as follows:

    #101 = #3001+1000 (#101 is 1 second from now)
    WHILE [[#101 GT #3001] AND [#1000 EQ 0]] D01
    END1 (Wait here 1 second or until #1000 goes high)
    IF[#1000 EQ 0] GOTO900 (Error trap for #1000 logic state "0" after i second)
    -------------
    -------------
    -------------
    GOTO910
    N900
    #3000 = 1 (Alarm Message)
    N910
    M99

    Regards,

    Bill

  9. #9
    Join Date
    Feb 2005
    Posts
    19
    Yes, you are correct that the M54 is the index command. It is tied in to the machine via an aux M-code relay at the moment. The 4 pin wire is used at the Haas control instead of the DB25. My goal is the get all of the communications to work off of the DB25 alone. I see what your saying about setting the state of the input variable. Thanks again and I will be trying it soon enough. I will keep you posted.

  10. #10
    Join Date
    Feb 2005
    Posts
    19
    UPDATE: I hqve made a lot of progress thanks to the help from this forum (attn: Bill). I currently have it working as suggested with the "A" variable and the M54 via program O9025. The only problem that I noticed is that if the Indexer is at , lets say 90.00, and I have a redundant line in the program, there is about a 3 second delay before machine will start.

    Example:
    Main Program,
    N1T1M6
    M54 A90.00
    G0G90G55X0Y0S5000M3
    G43H1Z1.0T2M8
    Z.1
    G81G98Z-.125R.05F20.0
    G80Z1.0M9
    G53G49Z0M5
    M1

    Sub Program:
    O9025
    POPEN
    DPRNT[]
    G04 P64
    DPRNT[UG090]
    G04 P64
    DPRNT[US#1[33]]
    G04 P64
    DPRNT[UF080.000]
    G04 P64
    M54
    G04 P250
    DPRNT[]
    PCLOS
    M99

    -------------------------------------
    So I guess what I need is a way to tell if the value desired is already stored in the variable so this way there can be a line to go beyond writing to the indexer if not needed. Any help is appreciated. Thanks guys

  11. #11
    Join Date
    Sep 2010
    Posts
    1230
    Hi Mike,
    You could try something like the following:

    O9025
    IF[#1 EQ #100]GOTO900
    POPEN
    DPRNT[]
    G04 P64
    DPRNT[UG090]
    G04 P64
    DPRNT[US#1[33]]
    G04 P64
    DPRNT[UF080.000]
    G04 P64
    M54
    G04 P250
    DPRNT[]
    PCLOS
    #100=#1
    N900

    M99

    A Volatile, Common variable has been used in the above example, meaning that it will retain its value between calls to the Macro, but will be initialized to Vacant when the Control is shut down, or, depending on parameter settings, when the Reset button is pressed. Depending on how the Indexer has to be initialized on start up, it may not be safe to use a Non-volatile Common variable (=> #500), where the last index value is stored even in the event that the control is shut down. Your experience with the indexer will dictate which type of variable to use.

    Regards,

    Bill

  12. #12
    Join Date
    Feb 2005
    Posts
    19
    Hey Bill, you are really making me look like a super hero here. All the solutions that you provided worked perfectly. There is no more delay now and the variable will be vacant upon pushing the reset button. NICE. Again, thank you for your time and patients. Any recommended book to read on macro programmIng?

  13. #13
    Join Date
    Sep 2010
    Posts
    1230
    Quote Originally Posted by unclemike1 View Post
    Hey Bill, you are really making me look like a super hero here. All the solutions that you provided worked perfectly. There is no more delay now and the variable will be vacant upon pushing the reset button. NICE. Again, thank you for your time and patients. Any recommended book to read on macro programmIng?
    Hi Mike,
    Pleased it worked out for you.

    I've not read it, but the book by sinha nsit receives good comments from this Forum. I don't know the details of it but I'm sure you'll be able to get a result via Google.

    Regards,

    Bill

  14. #14
    Join Date
    Feb 2005
    Posts
    19
    I've ran into my next problem. I set parameter #110 bit 0=1 to dedicate channel 2 (rs-232) in parameter #21 for sending DPRNT. I have my DNC on channel 0. I can read programs to the control with no problem but when I try to punch, I get nothing. If I change parameter #21 back to 0 it works fine. I've also tried to look for a parameter that clearly has a setting to solve this problem but, no luck. Thanks

  15. #15
    Join Date
    Jun 2013
    Posts
    1

    Re: Need help with making indexer macro.

    I am also trying to get my a YCM Supermax 1020xv to talk to the Haas HRT-210. We have been stuck at the first step. We have not been able to get the serial rs-232 communication working between the Fanuc Controller and the Haas indexer controller. We have tried a myriad of different settings on the two devices.

    Please help me by providing the settings that you use in both devices. Also, do you use a straight thru cable or a null modem cable?

    Any help would be appreciated.

Similar Threads

  1. Replies: 2
    Last Post: 12-19-2012, 01:28 PM
  2. Replies: 3
    Last Post: 02-13-2012, 07:20 PM
  3. Hardinge Indexer Macro
    By Terabithia in forum Fanuc
    Replies: 2
    Last Post: 08-06-2010, 03:35 PM
  4. Making best use of the 4th axis indexer
    By josh591 in forum Uncategorised MetalWorking Machines
    Replies: 0
    Last Post: 07-13-2008, 11:39 PM
  5. Convert Fanuc Macro to Fadal Macro
    By bfoster59 in forum Fadal
    Replies: 1
    Last Post: 11-09-2007, 06:41 AM

Tags for this Thread

Posting Permissions

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