Hello Guest it is December 14, 2019, 02:09:25 AM

Author Topic: Wait for signal  (Read 1079 times)

0 Members and 1 Guest are viewing this topic.

Re: Wait for signal
« Reply #20 on: January 25, 2019, 02:21:33 PM »
G21 G40 G54
G80 G90 G94
G00 X7.841 Y78.301
G00 Z0
G01 F60 Z-3
G00 Z2
G00 Y73.45
G00 Z0
G01 F60 Z-3
G00 Z2
M47
%

Re: Wait for signal
« Reply #21 on: January 25, 2019, 02:22:36 PM »
so ii want for example to wait for signal at this position:
G00 X7.841 Y78.301
Re: Wait for signal
« Reply #22 on: January 25, 2019, 03:04:12 PM »
Hi,
OK that's easy enough. What you need to do is insert a 'wait on signal' macro immediately after each
move that requires it.

That can be done as a macro. So open the script editor and open a new document but save it in your macros folder
of your current profile m199.mcs
This is the code:

Code: [Select]
function m199()
local inst=mc.mcGetInstance()
local rc=mc.mcSignalWait(inst,mc.ISIG_INPUT4,mc.WAIT_MODE_HIGH,10)
if (rc==mc.MERROR_TIMED_OUT) then
mc.mcCntlSetLastError(inst,'Timed Out')
return
end


end
if (mc.mcInEditor()==1)then
m199()
end

I have used this API (API.chm):
LUA Syntax:
rc = mc.mcSignalWait(
      number mInst,
      number sigId,
      number waitMode,
      number timeoutSecs);

Description:
Wait on a signal to change state.
Parameters: Parameter Description
mInst The controller instance.
sigId A valid signal ID. (NOT a signal handle)
waitMode An integer specifying whether to wait on the signal to go high (WAIT_MODE_HIGH) or low (WAIT_MODE_LOW).
timeoutSecs A double specifying a timeout period.


So in the code I have posted there is a 10 second TimedOut period while it waits for ISIG_INPUT4 to go high.

Craig
My wife left with my best friend...
     and I miss him!
Re: Wait for signal
« Reply #23 on: January 25, 2019, 03:42:19 PM »
Thank you Craig. You are the best mate and thank you for the time you spent for me. I am going to study a bit about Lua when i recieve the book. Maybe one day i can be EXPERT like you!!!!
Re: Wait for signal
« Reply #24 on: January 25, 2019, 04:04:48 PM »
Hi,
I am by no means an expert, scarely much more than a beginner.

I never bothered with the book, I just have the link open and delve into it at need.

Craig
My wife left with my best friend...
     and I miss him!