Hello Guest it is April 23, 2024, 07:17:14 AM

Author Topic: how do I pulse a relay for my blast gates to turn on/off?  (Read 555 times)

0 Members and 1 Guest are viewing this topic.

how do I pulse a relay for my blast gates to turn on/off?
« on: December 24, 2021, 12:03:36 PM »
My blast gates on my system are controled with a pneumatic cylinder. I would like to automate opening and closing the blast gate with the system.

I need to send a short pulse to open the blast gate and a short pulse to close it. If I control these with M7 or M8 for on, and M9 for off. A continuous pulse is sent to the relays opening/closing the cylinder.

How do I set the system so that a short pulse is sent with M8 or M9?

Or can I do something different and some how send a command when the spindle is turned on?

I'm just not sure what the correct way to do this is.
Re: how do I pulse a relay for my blast gates to turn on/off?
« Reply #1 on: December 25, 2021, 02:34:16 PM »
Winging it here.  Just an approach.
Create a register: GateState, set it to 0
Add to your M3 macro
local mInst = 0;
if (mcRegGetHandle(mInst, "core/global/GateState", &hReg) == MERROR_NOERROR) {
   rc = mcRegSetValue(hReg, 1);
}
Add to your M5 macro
local mInst = 0;
if (mcRegGetHandle(mInst, "core/global/GateState", &hReg) == MERROR_NOERROR) {
   rc = mcRegSetValue(hReg, 0);
}
in the start script declare a variable LastGateState and set it to 0
In the signal library Check to see if the state has changed
mInst = 0;
if (mcRegGetHandle(mInst, "core/global/GateState", &hReg) == MERROR_NOERROR) {
   local gatestate = mcRegGetValue(hReg, 0);
}
if LastGateState~=gatestate then{
  send your pulse
  lastGateState=gatestate
}

Syntax is probable wrong but you get the idea.  Someone else may have a better method.

HTH

RT
Re: how do I pulse a relay for my blast gates to turn on/off?
« Reply #2 on: December 28, 2021, 11:23:58 AM »
This is great thanks. I get the idea.

After thinking about for awhile I decided I am going to use a couple of unused M commands. I mill aluminum semi regulary, and don't want the DC on then. If I create custom M codes that would be better for my situation, although I will have to manually insert them in the output that fusion creates for me, But no big deal.

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: how do I pulse a relay for my blast gates to turn on/off?
« Reply #3 on: December 30, 2021, 02:47:40 PM »
Just create your m7 or m8 macro and within this just turn your signal on then back off, if its too quick then just add a wxSleep after the signal on.

DazTheGas
New For 2022 - Instagram: dazthegas