61
Mach4 General Discussion / Re: Mach4 cycles outputs during loading
« on: September 17, 2022, 01:34:24 PM »
I was going to say that a lot of this has to do with how the motion controller starts up. Specifically what state the inputs are in. If the inputs are steady, you will see no cycling. It is important to note that the SigLib is called when the state of the input changes. So if the code is cycling, that means the input itself is cycling. I would go so far as to say that my Galil does NOT exhibit this behavior. And it certainly isn't Mach cycling the inputs. So you must concentrate on how to mitigate the issue. First, I would ask for support from the motion controller vendor. Failing that, try to fix hardware in software (like we do every day!) and see if some script changes and switch wiring can help.
The below code will ONLY respond to signal changes AFTER the screen has loaded. However, this may not always be optimal as you may miss the initial state of the input. If you have toggle switches, it may be better to use momentary on switches.
Another thing you can do is see if you can shut the power off to the inputs while the machine is starting up and then once it is stable, power the inputs so that their state is then immediately seen.
Steve
The below code will ONLY respond to signal changes AFTER the screen has loaded. However, this may not always be optimal as you may miss the initial state of the input. If you have toggle switches, it may be better to use momentary on switches.
Code: [Select]
[mc.ISIG_INPUT9] = function (S20ActivateCoolantPump)
if (scr.IsLoaded()) then --- only process if the screen has completely loaded.
local inst = mc.mcGetInstance();
local hsig = mc.mcSignalGetHandle(inst, mc.OSIG_COOLANTON);
if (S20ActivateCoolantPump == 1) then
mc.mcSignalSetState(hsig, 1);
mc.mcCntlSetLastError(inst, "Flood coolant is ON")
else
mc.mcSignalSetState(hsig, 0);
mc.mcCntlSetLastError(inst, "Flood coolant is OFF")
end
end
end,
Another thing you can do is see if you can shut the power off to the inputs while the machine is starting up and then once it is stable, power the inputs so that their state is then immediately seen.
Steve