Hello Guest it is March 28, 2024, 02:41:01 PM

Author Topic: Can you use Inputs with Macro B Programming.  (Read 6215 times)

0 Members and 1 Guest are viewing this topic.

Can you use Inputs with Macro B Programming.
« on: November 20, 2017, 12:49:35 PM »
I've never used Macro B Programming, so I have a few questions about it.  Being able to use loops in G Code could really help us out on a project.  Can Macro B Read inputs to exit a loop?  If not, can you run an M Code in the loop that can read the input and then translate that into a #VAR to exit the loop?
Chad Byrd
Re: Can you use Inputs with Macro B Programming.
« Reply #1 on: November 20, 2017, 01:15:06 PM »
what kind of inputs? do you mean like lets say a switch? or an electrical signal?
Re: Can you use Inputs with Macro B Programming.
« Reply #2 on: November 20, 2017, 01:20:40 PM »
Yes.   A signal from our measuring device.  A mapped input into Mach4.
Chad Byrd

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: Can you use Inputs with Macro B Programming.
« Reply #3 on: November 20, 2017, 02:22:06 PM »
Have a look at http://www.machinetoolhelp.com/Applications/macro/macro_variables.html  It is kind of a cheat sheet on Macro B.

When referring to those variables, we use Tool Compensation Memory type C.  Like a Fanuc 21i.  

Specifically, the answer to your question is yes.  See the top of this page: http://www.machinetoolhelp.com/Applications/macro/system_variables.html  Input signals are mapped to #1000-1015.  However, we do extend that to #1000-1031 to cover the input signals INPUT #0 to INPUT #31.  The input signals WILL need to be mapped to valid device inputs.  

And you can turn on outputs signals too.  With #1100-1131

Those pages also have some examples of Macro B (loops, etc...) and how to use them.  But for the quintessential reference, Peter Smid has a book called "Fanuc CNC Custom Macros" that covers the subject.

Steve
Re: Can you use Inputs with Macro B Programming.
« Reply #4 on: November 20, 2017, 02:40:37 PM »
Awesome!  This should work nicely then.  My dad started the thread for the While Loops in a macro, not updating the screen while it is running.  We may very well be able to use this instead.  It would be a lot simpler.  Thanks for the info, I'm sure more questions will pop up.  I will try to keep this thread posted on my progress as well.  Thanks for the resources Steve.
Chad Byrd
Re: Can you use Inputs with Macro B Programming.
« Reply #5 on: November 20, 2017, 05:36:08 PM »
Another Question
Is there a #VAR for DRO's?  I need to read a few DROs for Rough Inc., Finish Inc., Spark Outs, Etc...
Chad Byrd

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: Can you use Inputs with Macro B Programming.
« Reply #6 on: November 20, 2017, 05:56:42 PM »
I can't find your dad's post.  :(

There are no #vars for DROs.  However, DROs can read/write any #var you choose.  Obviously, you don't want to step on #vars that do something important, so keep that in mind.  You accomplish this by using the DRO's Parameter property.  Enter 500 for #500, etc...  The DRO would then display whatever is in #500 and when you edit it, it would change the value of #500.

You would typically use a #var if you also want to make that information available to G code.  If you don't need that, then using a register as the backing store for the DRO would be better. 

Steve
Re: Can you use Inputs with Macro B Programming.
« Reply #7 on: November 20, 2017, 06:02:56 PM »
Here is his post.
http://www.machsupport.com/forum/index.php/topic,35666.0.html

I want this information to be used in the G Code.  For example, I can set DRO 500 to be my Rough Inc. at .002".  In my G code I use #500 to link it to the DRO?
Chad Byrd

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: Can you use Inputs with Macro B Programming.
« Reply #8 on: November 20, 2017, 06:07:01 PM »
Yes. 

Steve
Re: Can you use Inputs with Macro B Programming.
« Reply #9 on: November 20, 2017, 06:13:15 PM »
Okay.  That's great. 
Here is a very VERY rough idea of what we want to accomplish. 
Is this the right track at all?

O1000
#YAxis
#XAxis
#100 = GrindToDimension
#101 = Rough Increment 1
#102 = Rough Increment 2
#103 = Finish Increment
#104 = Spark Outs
#105 = X Start
#106 = X End
#107 = Feed Left
#108 = Feed Right
#109 = Grind Feed

M3 (Spindle On)
M8 (Coolant On)

(Rough Grind until the first switch.)
WHILE [#1000 NE 1] 
DO
G91G01 Y [#101] F [#109] (Feed in the Rough 1 Increment amount.)
G90G01 X [#106] F [#107] (Feed XStart to XEnd)
G90G01 X [#105] F [#108] (Feed XEnd to XStart)
END

(Rough Grind until the second switch.)
WHILE [#1001 NE 1]
DO
G91G01 Y [#102] F [#109] (Feed in the Rough 2 Increment amount.)
G90G01 X [#106] F [#107] (Feed XStart to XEnd)
G90G01 X [#105] F [#108] (Feed XEnd to XStart)
END

(Finish Grind until the third switch.)
WHILE [#1002 NE 1]
DO
G91G01 Y [#103] F [#109] (Feed in the Finish Increment amount.)
G90G01 X [#106] F [#107] (Feed XStart to XEnd)
G90G01 X [#105] F [#108] (Feed XEnd to XStart)
END

M5 (Spindle Off)
M9 (Coolant Off)
M30 (End Program)
Chad Byrd