How to vary a threshold with each M-code call


Results 1 to 5 of 5

Thread: How to vary a threshold with each M-code call

  1. #1
    Member Faust's Avatar
    Join Date
    May 2020
    Posts
    12
    Downloads
    0
    Uploads
    0

    Default How to vary a threshold with each M-code call

    Good day, everyone.

    I have a question that relates to Fanuc 18i/180i-Tb controllers. But I have to explain what I'm doing first.

    I have some Fuji ANW-30/3000/3500 machining centres. They run on Fanuc 18i/180i/0i b-Series controllers.

    I have written a custom M-code, M123, to monitor the the spindle load during a second's worth of cutting, and then I compare the value to a threshold value stored in a Data structure. If the value is below the threshold, then I know the cutter is broken/not installed, and I send out a fault message. This rudimentary current-monitoring system uses a lot of new ladder that I put into the system, and I use the WINDR function to read the threshold value from the data blocks, various compares, timers, Difus and other structures to accomplish the task.

    The problem is that I can only set a single threshold value. I use it for a grooving operation. However, I would like to use it for two different grooves, which cut through different parts of the part, and have greatly different load values. To this end, I'd like to be able to do the following:

    Either a.) Send a threshold value to use with the M-code, like sending an argument in a normal-programming-language function call. I don't know if this is possible, is it? I can't, say, send a command like M123<threshold value> can I?

    b.) Find a way to use a different M-Code (Maybe? Maybe something else?) that could pull a different threshold value yet use 95% of the same logic, so I wouldn't have to rewrite or expand everything so much.

    c.) Find a way to write different values into the data blocks from the NC, just before I call M123. I've heard that I can't write data blocks like a can with macro values. For example, the data blocks aren't just #xxxx values, so I can't just say "#xxxx=<threshold value>", right? Is there any way, though, to write new values to the data blocks, OR to just pull the threshold data from macro variables?

    I know this may sound like a confusing question, but I'm basically trying to assert dynamic input control over what amounts to a hard-coded, ladder logic-based subroutine.

    In case you're wondering "Why doesn't he just use a macro program?", the answer is I need this thing running in parallel with the machining itself, so I can't just stop the machining to wait for the cutting monitoring routine to finish; that'd be pointless.

    Thanks to anyone that can help!



  2. #2
    Member
    Join Date
    Jan 2014
    Posts
    106
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by Faust View Post
    Good day, everyone.

    I have a question that relates to Fanuc 18i/180i-Tb controllers. But I have to explain what I'm doing first.

    I have some Fuji ANW-30/3000/3500 machining centres. They run on Fanuc 18i/180i/0i b-Series controllers.

    I have written a custom M-code, M123, to monitor the the spindle load during a second's worth of cutting, and then I compare the value to a threshold value stored in a Data structure. If the value is below the threshold, then I know the cutter is broken/not installed, and I send out a fault message. This rudimentary current-monitoring system uses a lot of new ladder that I put into the system, and I use the WINDR function to read the threshold value from the data blocks, various compares, timers, Difus and other structures to accomplish the task.

    The problem is that I can only set a single threshold value. I use it for a grooving operation. However, I would like to use it for two different grooves, which cut through different parts of the part, and have greatly different load values. To this end, I'd like to be able to do the following:

    Either a.) Send a threshold value to use with the M-code, like sending an argument in a normal-programming-language function call. I don't know if this is possible, is it? I can't, say, send a command like M123<threshold value> can I?

    b.) Find a way to use a different M-Code (Maybe? Maybe something else?) that could pull a different threshold value yet use 95% of the same logic, so I wouldn't have to rewrite or expand everything so much.

    c.) Find a way to write different values into the data blocks from the NC, just before I call M123. I've heard that I can't write data blocks like a can with macro values. For example, the data blocks aren't just #xxxx values, so I can't just say "#xxxx=<threshold value>", right? Is there any way, though, to write new values to the data blocks, OR to just pull the threshold data from macro variables?

    I know this may sound like a confusing question, but I'm basically trying to assert dynamic input control over what amounts to a hard-coded, ladder logic-based subroutine.

    In case you're wondering "Why doesn't he just use a macro program?", the answer is I need this thing running in parallel with the machining itself, so I can't just stop the machining to wait for the cutting monitoring routine to finish; that'd be pointless.

    Thanks to anyone that can help!
    You can use the M123 for the first threshold setpoint for the first groove. Then when you are onto the second groove set a different M-code with a different setpoint to continuously monitor that function. After the cut turn the m-codes off and it would in turn,, turn off your monitoring logic for alarms.
    If it is a different tool for each grooves then create datatables individually for each tool, and set independent setpoints.
    OR
    Pull the setpoint out of a macro variable and possibly use an expression to monitor it in the part program



  3. #3
    Member
    Join Date
    Apr 2011
    Location
    USA
    Posts
    841
    Downloads
    0
    Uploads
    0

    Default Re: How to vary a threshold with each M-code call

    Wow, I’m impressed. We just did something similar to this on an OKK and what they used was macro variable #1133. What this does is set the value you want into F bits (F56 to be exact). So just before you read the M123 code in the part program you will set #1133=1234. The F56 bits will hold 1234. You can do a move command in the ladder and populate your data table with the values stored in F56. These F bits stay the same as long as you never write to them again or cycle power.
    Hope this helps



  4. #4
    Member
    Join Date
    Jul 2010
    Location
    South Africa
    Posts
    118
    Downloads
    0
    Uploads
    0

    Default Re: How to vary a threshold with each M-code call

    Hi,
    option C, just read the prepared variable value with windr function every time



  5. #5
    Member
    Join Date
    Jan 2014
    Posts
    106
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by drdos View Post
    Wow, I’m impressed. We just did something similar to this on an OKK and what they used was macro variable #1133. What this does is set the value you want into F bits (F56 to be exact). So just before you read the M123 code in the part program you will set #1133=1234. The F56 bits will hold 1234. You can do a move command in the ladder and populate your data table with the values stored in F56. These F bits stay the same as long as you never write to them again or cycle power.
    Hope this helps
    Thats pretty slick. #1133 unified" I/O.
    I haven't used this one before as a whole. Individuals yes.
    Its nice because the part programmer doesn't need to thumb through datatables.



Posting Permissions

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


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

How to vary a threshold with each M-code call

How to vary a threshold with each M-code call