Hello Guest it is March 28, 2024, 10:59:07 AM

Author Topic: mc.OSIG_SPINDLEON - how does this signal get turned on?  (Read 1359 times)

0 Members and 1 Guest are viewing this topic.

Offline bcoop

*
  •  61 61
    • View Profile
mc.OSIG_SPINDLEON - how does this signal get turned on?
« on: May 17, 2020, 05:28:09 PM »
my spindle clockwise button executes the function below, everything is work fine, but i'm trying to understand how mc.OSIG_SPINDLEON  gets turned on, 
I have searched all files without finding anywhere the output gets set or cleared.

Code: [Select]
function SpinCW()
    local sigh = mc.mcSignalGetHandle(inst, mc.OSIG_SPINDLEON);
    local sigState = mc.mcSignalGetState(sigh);
   
    if (sigState == 1) then
        mc.mcSpindleSetDirection(inst, 0);
    else
        mc.mcSpindleSetDirection(inst, 1);
    end
end

bob
« Last Edit: May 17, 2020, 05:29:41 PM by bcoop »
Bob
Re: mc.OSIG_SPINDLEON - how does this signal get turned on?
« Reply #1 on: May 17, 2020, 10:48:27 PM »
i didnt read the api about that function,but as i understand you need also set RPM i think

Offline thosj

*
  •  532 532
    • View Profile
Re: mc.OSIG_SPINDLEON - how does this signal get turned on?
« Reply #2 on: May 18, 2020, 07:54:01 AM »
......you need also set RPM i think

I've said it before and I'll say it again, Mach4 doesn't remember spindle speed between sessions, so before you can start the spindle you need to command a speed SOMEWHERE. S1000 in MDI, in gcode, in a script, somewhere.
--
Tom

Offline bcoop

*
  •  61 61
    • View Profile
Re: mc.OSIG_SPINDLEON - how does this signal get turned on?
« Reply #3 on: May 18, 2020, 09:30:04 AM »

I tested the scenario with spindle RPM needing to be set. that doesn't appear to be the case,  I with zero in Spindle speed,  mc.OSIG_SPINDLEON  still gets turned on.


Bob
Re: mc.OSIG_SPINDLEON - how does this signal get turned on?
« Reply #4 on: May 18, 2020, 10:02:34 AM »
The API call mc.mcSpindleSetDirection probably turns on the output

Offline bcoop

*
  •  61 61
    • View Profile
Re: mc.OSIG_SPINDLEON - how does this signal get turned on?
« Reply #5 on: May 18, 2020, 10:08:09 AM »
it appears that mc.mcSpindleSetDirection is happening only when mc.OSIG_SPINDLEON  signal is = 1 (on)






Code: [Select]
-- Spin CCW function.
---------------------------------------------------------------
function SpinCCW()
    local sigh = mc.mcSignalGetHandle(inst, mc.OSIG_SPINDLEON);
    local sigState = mc.mcSignalGetState(sigh);
   
    if (sigState == 1) then
        mc.mcSpindleSetDirection(inst, 0);
    else
        mc.mcSpindleSetDirection(inst, -1);
    end
end
« Last Edit: May 18, 2020, 10:11:58 AM by bcoop »
Bob

Offline bcoop

*
  •  61 61
    • View Profile
Re: mc.OSIG_SPINDLEON - how does this signal get turned on?
« Reply #6 on: May 20, 2020, 08:25:41 AM »
SwiftyJ, I believe you are correct,  relooking at the script,  it checks if direction bit is set, and if so, resets the direction bit, otherwise sets it, which somewhere in mach core code is turning on the OSIG_SPINDLEON output.   

thanks
Bob
Bob
Re: mc.OSIG_SPINDLEON - how does this signal get turned on?
« Reply #7 on: May 20, 2020, 09:20:47 AM »
This is set when you tell the spindle to start. This has nothing to do with the RPM... You can ask for a zero RPM with the spindle on and you will get that signal :). We have a spindle on and a spindle forward and reverse as signals.
{ "Spindle On", OSIG_SPINDLEON },
{ "Spindle Fwd", OSIG_SPINDLEFWD },
{ "Spindle Rev", OSIG_SPINDLEREV },

Hope I am helping here :)
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com

Offline bcoop

*
  •  61 61
    • View Profile
Re: mc.OSIG_SPINDLEON - how does this signal get turned on?
« Reply #8 on: May 20, 2020, 09:47:51 AM »
agree on the RPM,    but it appears to me that OSIG_SPINDLEON become true automatically whenever OSIG_SPINDLEFWD or OSIG_SPINDLEREV is turned on, I see no coding that is setting OSIG_SPINDLEON to True.
is it done is some complied Mach4 code ?
« Last Edit: May 20, 2020, 09:50:04 AM by bcoop »
Bob
Re: mc.OSIG_SPINDLEON - how does this signal get turned on?
« Reply #9 on: May 20, 2020, 10:22:50 AM »
That is all coded into Mach4.

Here is how we do spindle CW in the core:
   m_control->SetSignalState(OSIG_SPINDLEREV, false);
   m_control->SetSignalState(OSIG_SPINDLEFWD, true);
   m_control->SetSignalState(OSIG_SPINDLEON, true);

The idea is that you can have a relay for on and direction . Some of the VFD's need that rubbish :)

Thanks
Brian


Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com