Hello Guest it is August 18, 2019, 03:54:42 AM

Author Topic: Spindle runs on button double click but stops on M3  (Read 387 times)

0 Members and 1 Guest are viewing this topic.

Spindle runs on button double click but stops on M3
« on: January 21, 2019, 02:26:18 PM »
I have a new Chinese import Router, controlled by Mach3. After some experimentation, most aspects seem to be working fine. However, the spindle does NOT start when simply pressing the "Spindle CW F5" button. Yet, the yellow rim around the button starts blinking, indicating that the spindle should be running. When I click it again, the blinking yellow rim disappears and the spindle stops (the spindle actually turns a little bit before stopping completely). This behavior is very similar in code: M3 S10000 doesn't do anything, but an M5 AFTER that makes the spindle rotate a little before stopping. M5 without being preceded by an M3 doesn't do anything. So far, one might think that some pin wasn't set correctly or a connection fails. Yet, the strange thing is that we can actually use the router! This is done by removing all "M3" assignments from the code and starting the spindle manually. Starting the spindle manually requires a DOUBLE-CLICK on the "Spindle CW F5" button (yes: double click starts the spindle normally, single click doesn't work). When the spindle runs, an M3 assignment in the code stops it again?! That's why we remove all M3 assignments.
    =>  Single click or M3 code: spindle doesn't start but the button starts blinking (yet something happens because M5 behaves differently).
    =>  Double click: spindle starts normally while the button blinks (M3 stops the spindle, as does M5).
Accordingly, we have the impression that the machine works fine and the problem resides somehow in the software. We have searched and read a lot (and learned a lot too) but yet without a solution. :'(

Any help is highly appreciated.

Offline Tweakie.CNC

*
  • *
  •  7,882 7,882
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: Spindle runs on button double click but stops on M3
« Reply #1 on: January 22, 2019, 01:54:01 AM »
Can you check the logic state (voltage) of the Pin which connects to your spindle control (the pin configured by the Output# you have set for CW (M3) in Spindle Setup).

When you single click the spindle button this Pin should change state and the button start to blink - when you single click the button for a second time the Pin should change state and the button cease to blink.

If this occurs then I would suspect there is a problem with your spindle controller and not the Mach3 software.

Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.

Offline TPS

*
  •  1,375 1,375
    • View Profile
Re: Spindle runs on button double click but stops on M3
« Reply #2 on: January 22, 2019, 02:59:21 AM »
can you post your M3 macro.
it is normaly in C:\Mach3\macros\your Profile Name\M3.M1S

and a screenshot of Config -> Port's&Pin's -> Spindle Setup
« Last Edit: January 22, 2019, 03:01:25 AM by TPS »
anything is possible, just try it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Spindle runs on button double click but stops on M3
« Reply #3 on: January 22, 2019, 03:09:03 AM »
@Tweaky.CNC
Thanks for your suggestion. We will check this asap, although we have checked all pins as part of the process of setting up the system. Also, we don't expect the problem to be in the hardware (or hardware setup) as the spindle runs perfectly fine when we double-click the spindle button in the Mach3 interface (and it actually stops on M3 - I don't see how that can be caused by a defect in the spindle controller or an error in the pin-setup). It looks like there is some software safeguard that prevents M3 from doing its thing and which is overridden by a double-click.

We also checked the M3.m1s file which holds one line of code which seems to be just fine ( "DoSpinCW()" ). In addition, we added a file called M03.m1s with the same line of code (as someone suggested that the single click might try to access that in stead). Having said that, the single click does something, as only after a single click (or M3 code), the spindle stops on M5 (stopping means: it starts a little bit before stopping). We expect this also to be a software thing (we think that the stop-command is ignored e.g. if the "spindle running flag" is not set). Is there any way to check the implementation of DoSpinCW()?

@TPS
We checked this, as we have been looking through this forum quite extensively. The code seems fine (as described above) and matches the code of a fresh Mach3 install. It contains one line of code: DoSpinCW(). This line didn't contain a CR at the end - not sure if that is required. So we added CR-LF, but that didn't help either.


We are open for more suggestions  :-\

Offline TPS

*
  •  1,375 1,375
    • View Profile
Re: Spindle runs on button double click but stops on M3
« Reply #4 on: January 22, 2019, 03:27:34 AM »
i assume you are using the 1024 screenset and use tge Spindle F5 CW button.

this button does not call the M3 macro at all, because it uses the DoSpinCW() function directly.
so if you double click it is like a toogle , if spindle is on it will Switch it off.

if your run a short GCode witch only contains

M3
M5

it should do the same Thing.

so if spindle is in Outputs control that mean's only a pluse is created on the Output witch is defined in ClockWise M3 Setup.

you can check this on the diagnostic page, the spindle toggle button does the same as Spindle F5 CW button.
don't get  irritated of the Output LED's on the diagnostic page they are configurated as blink LED, so blinking means it is ON.


that was the reason for asking for the screenshot, only to see how your spindle is controlled in the Hardware.

so we Need some more Information about your Setup and Hardware, everything else is a walk in the dark.
« Last Edit: January 22, 2019, 03:38:05 AM by TPS »
anything is possible, just try it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline TPS

*
  •  1,375 1,375
    • View Profile
Re: Spindle runs on button double click but stops on M3
« Reply #5 on: January 22, 2019, 03:53:55 AM »
this button does not call the M3 macro at all, because it uses the DoSpinCW() function directly.

sorry this Statement is not correct, it uses the OEMButton(110) witch is -> Spindle CW, reset THC height
anything is possible, just try it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Spindle runs on button double click but stops on M3
« Reply #6 on: January 22, 2019, 04:49:17 AM »
Hi TPS,

Thanks for your further suggestions. I cannot access the machine right now, but will follow your instructions, probably tomorrow. However, I can clearly testify that the double-click definitely does something else than two single clicks: double click actually starts the spindle! By my knowledge, Windows generates another event for a double click than for a single click. There can be two different implementations having different effects (very different even, depending on the programmer). I have no clue how this is in Mach3 however.

As soon as I can, I will test whether a single button click invokes the M3.m1s script, simply by adding a MsgBox() command to that script and testing whether that message comes up. I expect it will. I will also check whether the double click does this as well ... (now I am curious).

Is there any way to access the implementation of DoSpinCW() command?

Offline TPS

*
  •  1,375 1,375
    • View Profile
Re: Spindle runs on button double click but stops on M3
« Reply #7 on: January 22, 2019, 06:59:14 AM »
As soon as I can, I will test whether a single button click invokes the M3.m1s script, simply by adding a MsgBox() command to that script and testing whether that message comes up. I expect it will. I will also check whether the double click does this as well ... (now I am curious).

neither a single than a double click will run the M3 macro, i am pretty sure, but you can test bay your own.

Is there any way to access the implementation of DoSpinCW() command?

no real idea, but maybe someone else knows.


as sayed, by my test (spindle configurated as relay control), the only difference was that

if you single click (spindle OFF) the Output is turned ON, and by the next single click it is turned OFF

if you double ckick, there is only a short pulse on configurated Output.

but all this is base on my PP testmachine, without any motoion Controller.

anything is possible, just try it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Spindle runs on button double click but stops on M3
« Reply #8 on: January 23, 2019, 11:18:00 AM »
Let me start by bringing the good news: we have solved the problem  :).

First, we modified the M3.m1s file such that we can see the difference between a direct call to DoSpinCW() and a call through the M3.m1s file (like a programmatic M3). The conclusion was clear (and in line with the remarks of TPS): pressing the "Spindle CW F5" button does NOT invoke the M3.m1s file and hence, the button-click event must turn the spindle on in a different way (e.g. by making an internal call to DoSpinCW ). On double-click it still started our spindle while a single click did not. Accordingly, I believe that there must be two different event handlers in place.

Because you insisted, we then checked all settings again, comparing them against the instructions from the manufacturer. Although everything was set as described in our machine documentation, I noticed that in "Ports & Pins", under the "Spindle Setup" tab, the checkbox for "Disable Spindle Relays" was UNchecked. I wondered about this setting before as, to my knowledge, our spindle is PWM controlled. Ignoring this manufacturer specification, I tried to check this box, effectively disabling the spindle relays. This appeared to solve our problem! :D

The double-click behavior remains a mystery, but our machine is now fully up and running.

Thank you for your concern and support.
Re: Spindle runs on button double click but stops on M3
« Reply #9 on: January 23, 2019, 02:34:34 PM »
In addition to what I wrote before, we modified the M3.m1s file such that, after starting the spindle, it has a build-in sleep of 4 seconds. This is the time that, according to our motor control settings, is needed to slow-start the spindle. Consequently, the spindle always has sufficient time to start and will run at the requested rate when the work actually begins. Being inexperienced with CNC routing (and Mach3), I wonder whether you consider this a clever of obsolete precaution. Please feel free to comment.