Hello Guest it is March 28, 2024, 07:40:07 PM

Author Topic: Mach4 Button OFFLINE  (Read 26854 times)

0 Members and 1 Guest are viewing this topic.

Re: Mach4 Button OFFLINE
« Reply #120 on: February 03, 2018, 03:50:17 AM »
Hi,
nothing works for me ...
Surely I'm wrong to do something.
« Last Edit: February 03, 2018, 03:51:53 AM by daniba73 »
Re: Mach4 Button OFFLINE
« Reply #121 on: February 03, 2018, 04:59:11 AM »
Hi,
runs fine here.

Have you tried running through the debugger in the editor? Remember that's why I set it up this way so that you could use the editor.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Mach4 Button OFFLINE
« Reply #122 on: February 03, 2018, 05:17:58 AM »
.
Re: Mach4 Button OFFLINE
« Reply #123 on: February 03, 2018, 05:30:13 AM »
Hi,
did you single step through it?

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Mach4 Button OFFLINE
« Reply #124 on: February 03, 2018, 05:40:55 AM »
Hi,
do you have the function in a separate folder as I recommended? The screenshot you posted looks like an event script...in which case I doubt you'll be able to
single step through the code.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Mach4 Button OFFLINE
« Reply #125 on: February 03, 2018, 05:56:46 AM »
I forgot about the folder!
as soon as I can I try again.
is everything good for you?

is asking too much trouble for a video of how to do it?

« Last Edit: February 03, 2018, 05:58:37 AM by daniba73 »
Re: Mach4 Button OFFLINE
« Reply #126 on: February 03, 2018, 06:12:52 AM »
Hi,

Quote
You will need to set up a folder where you can write and debug code without putting it in the screen load script and potentially screw Mach up while you mess around.
In your profile folder make a new folder OfflineButton. This is where you will put your code and work on it.

This was an instruction to make it easy for you to write/edit and debug the code. What you did instead was go direct to attaching the code to your button which
all but precludes you from testing it. You are trying to run before you can walk.

Once again: set up a folder in your profile that will contain the function. Put the function complete in the folder. Open the editor and browse to the folder and open
the contents in the editor. Run in single step mode, <f5> and <f11> repeating. At the last end statement press <shift f5> rather than crash the editor.
If you are going to program Mach you absolutely need to be able to use the editor and all its functions. I certainly wont be there to hold your hand! Put the code
in a folder and use the editor until you are 100% with it, no excuses!

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Mach4 Button OFFLINE
« Reply #127 on: February 03, 2018, 11:13:31 AM »
Craig

OK. I tested the macros on my CSMIO system.

 I started Mach4, left it disabled, and opened m201 in the debugger. Running the code, the M0 Enable LED turned on, and I could tell from the locking of the X axis motor that the CSMIO output had also been activated. So far so good. Next I ran m200 in the debugger. the M0 Enable LED turned off as expected, but contrary to my expectations the CSMIO output remained active, i.e. the X axis motor was still energised.

Pressing Enable/Disable caused the motor to lock and unlock, as expected.  I then ran the m201 macro again in the debugger,  This time the M0 Enable LED came on, but the CSMIO output did not, i.e. the motor remained unenergised. Enabling Mach4 and running the m200 macro in the debugger similarly produced no response from the CSMIO, i.e. in this scenario the M0 Enable LED turned off but the motor remained energised.

Finally I enabled Mach4 and ran the 2 macros from the MDI window. Neither had any effect, either on the LED or on the motor itself.

Though the results do not entirely echo those using the simulator, the overall conclusion remains that the Enable outputs cannot be programmatically changed using  API calls from user scripts. Your current approach ingvolving a second output and external logic would therefore seem to be the way ahead if this type of functionality is needed.

Note that my system does not exactly  echo that of the op. I have the CSMIO/IP-A with the latest v3.08 (beta) plugin. I couldn't do what the op hopes to achieve,  even if I wanted to, as the IP-A is closed loop and so would ssurely generate a PID error as soon as the motor position failed to match that expected by Mach.

Allan
Re: Mach4 Button OFFLINE
« Reply #128 on: February 03, 2018, 01:44:32 PM »
Hi Allan,
superb testing. Clearly Mach/CSMIO regard the Enable# signals as private and it is not reliable to programmatically set/rest them. Even stranger that
the CSMIO from time to time ignores the state of the signal.

I will double check with my machine but yesterday I had it working as I expected. Enable#0 turned on when Mach was enabled but could also be turned on and
off with macros and the state of the signal is reflected in the state of the output pin of my ESS/BoB combination. I was doing the testing I a hurry and
may therefore have overlooked some facet of its behavior.

In the mean time I have got some code using the second signal approach for Dany to run. It need some refinements like status messages and I think the
button should blink when 'Offline' is active but it works as is. He needs to work through the code so he knows how it works and also to use the editor/debug
functions.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Mach4 Button OFFLINE
« Reply #129 on: February 03, 2018, 02:13:10 PM »
Hi,
for reasons of time, unfortunately for a few days I can not test.
I will update you as soon as possible.
P.S.  I Never disable the units.
through the relay I will use a function, of which the units ignore any signal. (they still remain in position, without moving)
when the function changes state, normal use of the drives is restored.
« Last Edit: February 03, 2018, 02:14:52 PM by daniba73 »