Hello Guest it is April 24, 2024, 06:47:17 PM

Author Topic: Wait for signal  (Read 8495 times)

0 Members and 1 Guest are viewing this topic.

Re: Wait for signal
« Reply #10 on: January 25, 2019, 01:13:05 PM »
Hi,
try pasting this code into your script:

Code: [Select]
local inst=mc.mcGetInstance()
local signalHandle=mc.mcSignalGetHandle(inst,mc.ISIG_INPUT4)
local wait= mc.mcSignalGetState(signalHandle)
if wait==0 then
mc.mcCntlFeedHold(inst)
else
mc.mcCntlCycleStart(inst)
end


Note that this code is pretty crude. If your input signal is low AT ANY TIME it will stop whatever job is running
and if it goes high the job, or any job loaded will start whether you wanted it to or not.

Is this want you want?. If so then you can put it into the PLC script and try it. If it is too crude then you need to think about
'under what circumstances do I want the job to pause while waiting for this signal'

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Wait for signal
« Reply #11 on: January 25, 2019, 01:17:18 PM »
I want it to wait when it is above one certain coordinate  x... y...z... and check one input only. So if you could add an example of coordinates at your script I ll buy you a beer. Thank you Craig
Re: Wait for signal
« Reply #12 on: January 25, 2019, 01:23:49 PM »
I mean this is exactly what I want but only above a specific coordinate to do the checking.
Re: Wait for signal
« Reply #13 on: January 25, 2019, 01:28:31 PM »
Hi,
OK the code I have posted wont do at all, it would run every few milliseconds the entire time Mach is running and
affecting the behavior of the machine all the while.

Quote
I want it to wait when it is above one certain coordinate  x... y...z... and check one input only

So in fact you want this 'wait on signal' to happen only during a specific Gcode job? So any other Gcode job or MDI
commands or jogging would not be affected?

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Wait for signal
« Reply #14 on: January 25, 2019, 01:30:46 PM »
No just to check during a g code procedure a signal if it's triggered above a specific coordinate to wait or to go. That's all.
Re: Wait for signal
« Reply #15 on: January 25, 2019, 01:32:58 PM »
Leave from point A go to point B return to point A if the signal is on then go to point B or just wait
Re: Wait for signal
« Reply #16 on: January 25, 2019, 01:35:53 PM »
Hi,
so you want this 'wait on signal' to occur when any Gcode job is running and only if it strays into a particular area?

Is the area fixed (relative to the table), ie defined by machine coordinates or is I relative to the job, ie work coordinates?

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Wait for signal
« Reply #17 on: January 25, 2019, 01:38:58 PM »
Hi,
what I'm trying to work out is whether you need to insert a macro at each instance in your Gcode file where you wish this
behavior to occur or whether you need the machine to behave in this way whenever Gcode is running?

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Wait for signal
« Reply #18 on: January 25, 2019, 01:44:29 PM »
i want to make something like a pick and place. With work coordinates i leave from point A then i go leave something to place B then return to point A and if a sensor detects the item in part A, i proceed other wise i wait for the signal. So i think always when g code is running for the specific job.....
Re: Wait for signal
« Reply #19 on: January 25, 2019, 02:07:24 PM »
Hi,
OK that makes sense.

How do you generate the Gcode for your pick-and-place machine?
What I am thinking is that after each move which requires a potential wait state that you would code a macro,
something like m199().

g0 x 123.456 y234.567                             --move to position A and be prepared to wait
m199()                                                    --macro that includes the wait code and when the signal is good then returns the machine
g0 x 567.890 y456.789                             --new move to position A and repeat
m199()

For every move which requires this 'wait on signal' behavior then you would have to add an extra line m199().
If you had many hundreds of moves that would be very tedious. Depending on how you generate the Gcode
you may be able to insert it automatically.

can you post a small excerpt of your code?

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'