Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: darlly01 on June 10, 2012, 04:10:06 PM

Title: subroutine creation help!!
Post by: darlly01 on June 10, 2012, 04:10:06 PM
Hi everybody.

I'm doing well with all help I ready here on this forum. I need a little help with my doubt.

I need to make an output activate on start of circle cut and put a timer on that output to deactivate before circle end.
I try to use the function sleep but the circle wont start till sleep finish, maybe I putting in wrong sequence, any help will be very welcome.

thanks, wonderful day for all! ??? ???
Title: Re: subroutine creation help!!
Post by: BR549 on June 10, 2012, 10:52:29 PM
The only two ways I know to make it owork would be to use a brain to do a countdown then deactivate the signal. You would have to set  up a Mcode to active a led to start the brain.

From straight Gcode no can do that I know of.

OR just activate the output at the start of the circle but do the circle in 2 parts and insert the outputoff where it is needed in the circle code.

Just a thought, (;-) TP
Title: Re: subroutine creation help!!
Post by: Graham Waterworth on June 11, 2012, 07:50:12 AM
The only other way I can think of is to split the circle into segments and then use M codes in between the segments to control the output.

Graham
Title: Re: subroutine creation help!!
Post by: darlly01 on August 26, 2012, 09:42:51 PM
I did it with a circle split in two arc, but when output get activated or deactivated it stop the movement. I need it become continuous movement. Is there anyway to activate and deactivate the output out of Gcode sequence?
thanks all for the attention.
darli
Title: Re: subroutine creation help!!
Post by: cncalex on August 27, 2012, 08:48:24 PM
You can do it using a brain watching the x and y axis position and switch an output at a position where you want it.
Just testet. looks good to me. maybe a little bit difficult but should work.

Alex
Title: Re: subroutine creation help!!
Post by: darlly01 on August 27, 2012, 09:11:09 PM
hi cncalex,
thanks for your attention to my post. Could you please, send me an example. I'm newbie and have difficult to start it.
thanks
Title: Re: subroutine creation help!!
Post by: cncalex on August 28, 2012, 08:57:06 AM
hi darllly01
I played around an found the easiest way to do is to use a free additional axis ( A , B, or C)
I use the A axis for testing. it is not necessary to assign the axis to any port or pin just check
the axis to enable so that the DRO is working. I attach a g code and a brain where you can see
how it works. The brain switches on the output 1 when the a axis value is less then 0 .
You can play around with the a axis value in the g code to match the optimal points
for switching the output on and off. To activate the brain copy it into the brains folder in mach.
Then start mach, go to operator menu click brain control then click reload all brains then enable
brain test-1.brn then click on the brain and click brain view. then you can watch how it works.
( when the code is running )

hope that helps  :D
Alex
Title: Re: subroutine creation help!!
Post by: darlly01 on August 28, 2012, 10:21:41 PM
thank you cncalex.
It works perfect with the brain. I'm just playing around to see if I can make the output go ON and OFF without a little stop with the gcode sequence. Maybe you have an idea. I want to make a circle and start applying glue and stop glue application at the end of the circle, and make a little arc in the same path with no glue application to compensate the inertia of the glue dispenser. But it giving a quick stop. I'd like to have it in continuos move.

thanks for your great help.

Darli
Title: Re: subroutine creation help!!
Post by: cncalex on August 28, 2012, 11:31:28 PM
hmm,
with the brain there should be a continuos move while the output turns on and off. I have a continuos move here.
Can you attach your g code. That can help me understanding.

Alex