90
« on: May 28, 2017, 09:25:48 PM »
hello thank you for your reply i put this together and pray it will work. i will be testing it tomorrow
---------------------------------------------------------------
-- Ref All Home() function.
---------------------------------------------------------------
function RefAllHome()
mc.mcAxisDerefAll(inst); --Just to turn off all ref leds
--mc.mcAxisHomeAll(inst);
--set outputs for Z multiplex
local out2 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT2) -- OUTPUT FOR MULTIPLEXER
local out3 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT3) -- OUTPUT FOR MULTIPLEXER
local out2 = mc.mcSignalSetState(inst,0)--output off
local out3 = mc.mcSignalSetState(inst,0)--output off
mc.mcAxisHome(inst,2); -- assuming axis 2 is Z, commonly the case
--set outputs for Y multiplex
local out2 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT2) -- OUTPUT FOR MULTIPLEXER
local out3 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT3) -- OUTPUT FOR MULTIPLEXER
local out2 = mc.mcSignalSetState(inst,0)--output off
local out3 = mc.mcSignalSetState(inst,1)--output on
mc.mc.AxisHome(inst,1); -- assuming axis 1 is Y, commonly the case
-- set outputs for X multiplex
local out2 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT2) -- OUTPUT FOR MULTIPLEXER
local out3 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT3) -- OUTPUT FOR MULTIPLEXER
local out2 = mc.mcSignalSetState(inst,0)--output off
local out3 = mc.mcSignalSetState(inst,1)--output on
mc.mcAxisHome(inst,0); -- assuming axis 0 is X, commonly the case
coroutine.yield() --yield coroutine so we can do the following after motion stops
----see ref all home button and plc script for coroutine.creat and coroutine.resume
wx.wxMessageBox('Referencing is complete')
wx.wxMessageBox('Dont forget turn on soft limits')
end
one of the biggest problems i have with lua is turning on outputs i find it confusing and it shouldnt be i have read different accounts of how to do this but i dont know get handle, set state. i could always in vb just say output on/output off and be done. if anybody can point me to the proper text. big sign this will work to turn on an output. i understand inputs all right and have been able to get them to do what i want but outputs confuse me. thank you for reading and if you have any advise on structure please let me know
m