Hello Guest it is April 18, 2024, 08:44:16 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - CITO

Pages: 1
1
Hello,

I don't know what it is, but the problem is back, I changed nothing  :(
and there is a second problem, I configured the Mist funktion and the Single Block funktion also on external buttons and it works to begin perfectly,
but now the Mist and Single Block turned on when the Mach4 screen is loading, I have to turn them off. After this procedure all funktions are still working.

Here is the code I use.


Code: [Select]
---------------------------------------------------------------
-- Signal Library
---------------------------------------------------------------
SigLib = {

---------------------------------------------------------------
-- Tool IN / OUT
---------------------------------------------------------------
[mc.ISIG_INPUT3] = function (state)
local inst = mc.mcGetInstance();
local IOName = mc.OSIG_OUTPUT5 --Save the name of the Signal (as stored inside of Mach4)
local ActivateSignalTime = 1000 --Time in milliseconds that we want the signal to be active.
local hReg = 0 --The handle to the signal
local rc = 0
local hSig, rc = mc.mcSignalGetHandle(inst, IOName)

if (rc ~= 0) then --There was error
    mc.mcCntlSetLastError(inst, "There was an error")
else
if (state == 1) then
rc = mc.mcSignalSetState(hSig, 1) --Turn the output on
if (rc ~= 0) then --There was error
mc.mcCntlSetLastError(inst, "There was an error")
else
wx.wxMilliSleep(ActivateSignalTime) --Sleep for the commanded time (so that the output stays on as long as we want).
rc = mc.mcSignalSetState(hSig, 0) --Turn the output off
if (rc ~= 0) then --There was error
mc.mcCntlSetLastError(inst, "There was an error")
end
end
end
end
end,

[mc.ISIG_INPUT20] = function (state)
if (state == 1) then
Mist()
else
        --do nothing
end
end,

[mc.ISIG_INPUT21] = function (state)
if (state == 1) then
SingleBlock()
else
--do nothing
end
end,




---------------------------------------------------------------
-- Mist function.
---------------------------------------------------------------
function Mist()
      local inst = mc.mcGetInstance();
      local sigh = mc.mcSignalGetHandle(inst, mc.OSIG_MISTON);
      local sigState = mc.mcSignalGetState(sigh);
        if (sigState == 0) then
          local OSigMist = mc.mcSignalGetHandle (inst, mc.OSIG_MISTON)
          mc.mcSignalSetState(OSigMist, 1)
          mc.mcCntlSetLastError(inst, "Mist On")
        else
          local OSigMist = mc.mcSignalGetHandle (inst, mc.OSIG_MISTON)
          mc.mcSignalSetState(OSigMist, 0)
          mc.mcCntlSetLastError(inst, "Mist Off")
        end
    end
end

---------------------------------------------------------------
-- Single Block function.
---------------------------------------------------------------
function SingleBlock()
local sigh = mc.mcSignalGetHandle(inst, 0);
local sigState = mc.mcSignalGetState(sigh)
if (sigState == 1)then
mc.mcCntlSetSingleBlock(inst, 0)
else
mc.mcCntlSetSingleBlock(inst, 1)
end
end

Thanks for Help  ;)

Greetings
Oliver

2
Mach4 General Discussion / Re: Button config for manual toolchange
« on: May 23, 2019, 06:21:35 AM »
Hi Chaoticone,

thanks a lot, it works.

Only if I edit the screen and Mach4 reload it, the Output is shortly activ, but it's no problem

3
Mach4 General Discussion / Re: Button config for manual toolchange
« on: May 11, 2019, 02:36:39 AM »
nobody a solution?

4
Mach4 General Discussion / Re: Button config for manual toolchange
« on: May 06, 2019, 05:17:48 PM »
Hello and thank you for reply

I did it, but not 100%, while the screen is loading the output signal switched on (one time).
It should do that only if I press the external Button

Here is the Code

Code: [Select]
---------------------------------------------------------------
-- Tool IN / OUT
---------------------------------------------------------------
[mc.ISIG_INPUT3] = function (state)
if (state == 1) then
local inst = mc.mcGetInstance();
local IOName = mc.OSIG_OUTPUT5 --Save the name of the Signal (as stored inside of Mach4)
local ActivateSignalTime = 1000 --Time in milliseconds that we want the signal to be active.
local hReg = 0 --The handle to the signal
local rc = 0

hSig, rc = mc.mcSignalGetHandle(inst, IOName)
if (rc ~= 0) then --There was error
mc.mcCntlSetLastError(inst, "There was an error")
else
rc = mc.mcSignalSetState(hSig, 1) --Turn the output on
if (rc ~= 0) then --There was error
mc.mcCntlSetLastError(inst, "There was an error")
else
wx.wxMilliSleep(ActivateSignalTime) --Sleep for the commanded time (so that the output stays on as long as we want).
rc = mc.mcSignalSetState(hSig, 0) --Turn the output off
if (rc ~= 0) then --There was error
mc.mcCntlSetLastError(inst, "There was an error")
end
end
end
end
end,

Please, can somebody help me to fix this problem?


Greetings
Oliver

5
Mach4 General Discussion / Button config for manual toolchange
« on: May 01, 2019, 04:58:00 PM »
Hello together,
my name is Oliver and I'm from Germany, my english is not so good please excuse ;)
I'm new in Mach4 and my skills in Mach4 are at the beginning.
I want to change a tool by pressing an external Button (it's an ATC-Spindel, air pressed for tool change).
I think the Input Signal from this button must be mapped to the Output signal for the magnetic valve for the spindle, but how can I do that.
In the future the tool change should be automatically, but step by step.

My Controller is a csmio/ip-s, the machine is a DIY-milling machine

Please, can anybody help me?


Greetings
Oliver

Pages: 1