Input conformation within macros

More
09 Sep 2015 13:00 #62302 by mgenton85
I have several machines that i automated to do secondary operations and i was using mach3. however i need more speed for my mills than a smooth stepper can give me. I am using Pico Systems USC. and I for the life of me cant figure out how to check my confirms ie chuck-clamp part-load, i had mach setup to do the entire load routine with one mcode and i am looking to do the same with linux. i need to check do i have parts to run and then make sure i have loaded then make sure chuck has clamped run unload repeat .

I have tried M66 for my inputs but that wasnt working and i need alot of inputs
I added in my custom-hal net part-load <= ppmc.0.din.00.in (where 00 is the input pin) and it toggles in the hal configuration fine, now with all this said how to I query the input with a IF statement in a macro?

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

More
09 Sep 2015 18:18 #62315 by BigJohnT
You could use ClassicLadder to run your loading/unloading.

Why did M66 not work?

JT

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

More
09 Sep 2015 18:57 - 09 Sep 2015 20:49 #62316 by mgenton85
this particular machine is a lathe with the loader and unloader mounted to the table i calll the as tools
to be honest i dont understand the ladder well enough but there has to be gcode as part of the loading routine and i am in a huge time crunch atm

i tried M66 P0 L0 Q0
o100 if [5399 EQ 1]
(MSG, no part in loc)
m2
o100 else
(MSG,run)
o100 endif

if i could get that to work i would be ok maybe i need something added to my .ini so it can ead the var but what i would like till i have more time to study the hal

is something like this ( i dont know the proper syntax so i will try and illustrate

#1 = part-load (this is the bit from net partload <= ppmc.0.din.00.iin)
o100 if [#1 LE 0]
(MSG, no part in loc)
m2
o100 else
(MSG,run)
G0 G90 G43H1 X0
Z-1.
setp ppmc.0.dout.00.out 1 (load part)
G4 P1.
setp ppmc.0.dout.01.out 1 (clamp part)
G4 P1
(some way to verify that i clamped)
setp ppmc.0.dout.00.out 0 (load part retract)
G4 P1
o100 endif

this what i cant understand how to accomplish
might be worth noting that my programming experience is with gcode and arduino ladder i havent messed with much
I really need a example that will help me to understand this because i have spent all day yesterday and have nothing that works



EDIT:
ok in the [RS274NGC] I added FEATURES=8
now

M66 P0 L0 Q0
o100 if [#5399 EQ 1] (added # )
(MSG, no part in loc)
m2
o100 else
(MSG,run)
o100 endif

this works now i need to figure out how to repeat the code untill i run out of parts
Last edit: 09 Sep 2015 20:49 by mgenton85.

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

More
09 Sep 2015 21:37 #62322 by BigJohnT

EDIT:
ok in the [RS274NGC] I added FEATURES=8
now

M66 P0 L0 Q0
o100 if [#5399 EQ 1] (added # )
(MSG, no part in loc)
m2
o100 else
(MSG,run)
o100 endif

this works now i need to figure out how to repeat the code until i run out of parts


Do you really want to end the program a the M2? Seems to me a M0 would be a better choice.

JT

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

More
09 Sep 2015 21:54 - 09 Sep 2015 21:56 #62325 by mgenton85
M2,M30 or M0 will work fine i just need to stop
but the big issue is how to get more inputs than the 4 or 5 the M66 will give me

is there a way to do the same thing as M66 in my custom mcode thats not M66?

and i am still having trouble looping my main code i want to loop till i run out of parts like a fanuc M99
Last edit: 09 Sep 2015 21:56 by mgenton85.

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

More
09 Sep 2015 23:25 #62333 by andypugh

but the big issue is how to get more inputs than the 4 or 5 the M66 will give me


You can add more digital (and analogue) inputs via a parameter to motmod:

linuxcnc.org/docs/html/man/man9/motion.9.html

Look through your HAL file for "loadrt motmod" and add "num_dio=64" to have 64 IO pins to use.

You might want to do some of the logic in HAL. LUT5 is very useful for combining inputs into a single output.
The following user(s) said Thank You: mgenton85

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

More
10 Sep 2015 00:02 #62335 by mgenton85
this is the only way i could figure out how to loop my main program
if there is a better way i would love to know

now can i use the M66 in a custom Mcode ?? time to test


%
(LOOP UNTILL MAX COUNT MET)
#<MAXCOUNT> = 3 (SET TO WHAT YOU DESIRE)


o100 sub
#<C> = 0
o101 while [#<C> LE #1 ]
o200 call (CALL YOUR CODE o###)
#<C> = [#<C> + 1]
(debug,COUNT is:#<C>) (REMOVE IF YOU DONT WANT MSG)
o101 endwhile
#<C> = 0
o100 endsub

o200 sub (THIS SUB CHECKS IF THERE IS PARTS IN HOPPER)
M66 P0 L0 Q0 (CHECKS INPUTPIN DEFINED IN custom.hal)
(net part-in-loc motion.digital-out-00)
o201 if [#5399 EQ 1] (THIS IS THE M66 VAR EITHER 0-1)
#<RUN> = 1
(MSG,RUN parts)
o201 elseif [#5399 EQ 0]
#<RUN> = 0
(MSG,LOAD parts)
o201 endif
o300 call [#<RUN>]
o200 endsub

o300 sub
o310 if [#1 GE 1] (MAIN PROGRAM)
(PREP CODES)
G0 G90 G54
(MAIN CODE GOES HERE)
o310 else
M30 (M0,M2,M30 WHATEVER SUITS YOUR NEED)
o310 endif
o300 endsub


o100 call [#<MAXCOUNT>]
(MSG,PRG END)
M30
%

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

More
10 Sep 2015 00:22 #62336 by mgenton85

but the big issue is how to get more inputs than the 4 or 5 the M66 will give me


You can add more digital (and analogue) inputs via a parameter to motmod:

linuxcnc.org/docs/html/man/man9/motion.9.html

Look through your HAL file for "loadrt motmod" and add "num_dio=64" to have 64 IO pins to use.

You might want to do some of the logic in HAL. LUT5 is very useful for combining inputs into a single output.


NOTE
the location to add num_dio=64 was in my ini file
#motion control section
EMCMOT = motmod num_dio=64

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

More
10 Sep 2015 00:31 #62337 by andypugh

the location to add num_dio=64 was in my ini file
#motion control section
EMCMOT = motmod num_dio=64


I am not sure if it works in the INI file. Have you tried putting it in the HAL file?

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

More
10 Sep 2015 00:45 - 10 Sep 2015 00:49 #62340 by mgenton85
I tried adding to the hal file I wasnt sure where to put it, I tried several times and control wouldnt load.
however it loads fine adding it to the ini and it works! Ii tested it before I posted the location in the ini.
Last edit: 10 Sep 2015 00:49 by mgenton85.

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

Time to create page: 0.165 seconds
Powered by Kunena Forum