Subroutine, Call program, If statements

More
23 Aug 2021 23:00 #218559 by tjones
I am setting up some simple automation to feed parts into a CNC router.  Once parts are fixtured I want to use an input signal (coming from an external PLC) in an if statement to call the right program for that fixture.  All the examples I see in the manual for IF statements us a parameter to compare to some value. Are parameters the only options you can use in an IF statement?  If so, I would assume I need to map an input signal to a system parameter. If I set a input signal to a digital input does that automatically create a system parameter I can use? Is there a more in depth manual to go over conditional statements somewhere?  

Please Log in or Create an account to join the conversation.

More
24 Aug 2021 04:03 - 24 Aug 2021 04:07 #218582 by Henk
Assuming you use digital IO between lcnc and your PLC, you can configure say 4 signals in a BCD pattern based on which fixture is loaded. This can give you 16 fixture options.

In lcnc you can use mux16 component to convert the BCD to a float value which you can read in your NGC program using m67 and compare in an if statement

Edit.....sorry. looks like you can only output analog values from NGC program....ignore the above....
Last edit: 24 Aug 2021 04:07 by Henk.

Please Log in or Create an account to join the conversation.

More
24 Aug 2021 17:33 - 24 Aug 2021 17:38 #218629 by tjones
All I need to do is read an input (not that the card matters in this discussion but I will be using a 7i76E) and make a program selection. So if the mux16 works to read an input then we should be good. I am not outputting anything to the PLC, if I am, it would be standard M code stuff, but that pretty straight forward.
Last edit: 24 Aug 2021 17:38 by tjones.

Please Log in or Create an account to join the conversation.

More
27 Aug 2021 16:42 #218921 by andypugh
Did you sort this out?
What is the nature of the signal that you want to read?

In any case, M66 is likely to be the G-code you need to read the result into a parameter to use in your conditional

Please Log in or Create an account to join the conversation.

More
27 Aug 2021 16:50 - 27 Aug 2021 16:54 #218923 by tjones
I think so. Looks like M66 should do what I want. Essentially I have a PLC controlling a infeed conveyor/fixture for some wood sheet parts. Once the part is fixtured the PLC will output a ready signal. There are multiple conveyor lanes incoming to the CNC, so I just want the main code to loop/scan for the ready signal to machine that fixtures part. The signal itself is a Digital signal, just on or off.
Last edit: 27 Aug 2021 16:54 by tjones.

Please Log in or Create an account to join the conversation.

Time to create page: 0.063 seconds
Powered by Kunena Forum