Hello Guest it is April 23, 2024, 03:28:10 PM

Author Topic: HOW TO DETECT THAT IS RUNNING MACH3 IN POKEYS57CNC  (Read 11527 times)

0 Members and 1 Guest are viewing this topic.

Re: HOW TO DETECT THAT IS RUNNING MACH3 IN POKEYS57CNC
« Reply #10 on: December 01, 2016, 03:01:51 PM »
I may not fully understand your goals, but after reading through this thread again I think I have a grasp on what you want to do.  When Mach3 is active it should have control over machine movement.  When Mach3 is not active or the computer is not running you want a poblocks configuration to allow machine movement via MPG or other manual control method???

You don't need a brain, macro pump or vb script, though you could probably accomplish the task with one or more of these tools.

The simplest way I can think of is to:

1) activate "Enable safety charge pump (pin 45) and keep "Enable in emergency (reset)" unchecked in the Pokeys plugin for Mach3.

2) Jumper pin 45 and 43 on the Analog inputs connector on the 57CNC.

3) Load the attached Poblock to the 57cnc board via the Poblocks application.  or merge the poblock configuration that is attached into your current custom poblocks build.  This is one method for telling a poblocks configuration that Mach3 is active.

4) For testing purposes only: wire an led from pin 13 on the Encoders connector on the 57cnc board to a ground pin next to pin 13.  If your using pin 43 and/or pin 13 in the plugin for Mach3 you will have to disable them to allow the poblock program to have access to these i/o's.

When Mach 3 is active (running and out of estop) the LED on between pin 13 and GND will light.  When in active estop or you close Mach3 the led will go off.
Re: HOW TO DETECT THAT IS RUNNING MACH3 IN POKEYS57CNC
« Reply #11 on: December 01, 2016, 03:25:04 PM »
Just another note:

Mach3 and Poblocks can communicate via pins as long as they are configured correctly on each side.  If a Poblocks application uses pin 1 for example them Mach3 plugin can not use pin 1 for anything.  The same goes in reverse.  This method allows you to have an output from Poblocks (say pin 1) communicate to Mach3 on an input pin (say pin 2).  You configure the output pin 1 in Poblocks and configure the input pin 2 in the Plugin for Mach.

Shared pins can be used by both but the Mach3 to Poblocks is limited in number of pins (21-27) and if you want to only communicate simple logic level stuff you have to create an LED, DRO and brain as mentioned earlier.


Re: HOW TO DETECT THAT IS RUNNING MACH3 IN POKEYS57CNC
« Reply #12 on: December 01, 2016, 06:19:24 PM »
Thank you turboedges.
I have managed to make it work perfectly. Now I understand how it is done.

The truth is that if you do not tell it difficult to find documentation on these incompatibilities when setting pins from Poblocks and the Mach3 plugin on PoKeys devices.
Re: HOW TO DETECT THAT IS RUNNING MACH3 IN POKEYS57CNC
« Reply #13 on: December 02, 2016, 01:46:59 AM »
Bufff. It did not work for me! :'( :'( By integrating this solution into PoBloks, I have discovered that output 13 is set to 1 even when the pulse engine is activated by manually moving the axes with the MPG.

I have to look for a solution that shows me only what I need: that Mach3 is active.

I still think that the solution is to permanently check through the macropump if the button of the red cross of closing of the Mach3 application has been pressed. Any ideas?
Re: HOW TO DETECT THAT IS RUNNING MACH3 IN POKEYS57CNC
« Reply #14 on: December 02, 2016, 09:32:56 AM »
If your willing to share your poblocks .xml I might be able to assist.  I understand if you are not willing.  I am sure there is some other poblocks configuration that can solve for this.
Re: HOW TO DETECT THAT IS RUNNING MACH3 IN POKEYS57CNC
« Reply #15 on: December 02, 2016, 01:01:04 PM »
I enclose a reduced version with only two modes of operation, automatic and MPG.

As in the AUTO mode the pulse engine of PoKeys57CNC is disabled, it is Mach3 which causes the 5kHz signal of the charge pump to be output from the pin 45. In this AUTO mode, if I close Mach3 the 5 kHz signal disappears.

The problem is that, if this Mach3 is closed, I select the MPG mode, the 5 kHz signal appears. What I need is to generate a signal that prevents me from selecting any other mode, other than AUTO, if and only if Mach3 is active.

How I am able to send a signal (a 1 for example) to PoKeys57CNC from Mach3 when I start it, the only thing I do not know is to be able to put that signal to 0 when I close Mach3. I think that if I am able to detect by code (macropump) that I pressed the button to close Mach3, I will be able to detect its shutdown and act accordingly within my code.

I hope you have understood me. I do not express myself very well in English.
Re: HOW TO DETECT THAT IS RUNNING MACH3 IN POKEYS57CNC
« Reply #16 on: December 02, 2016, 03:52:38 PM »
I have noticed that  the plugin for Mach3 seems to leave a pin i/o state in its last know status when closing. 

So if the i/o pin that the poblocks app is looking at is high (say Mach3 active) when closing Mach3 the signal will stay high until Mach3 is restarted.  Obviously this isnt what you want.  Your goal would be to have the signal go low when closing Mach. 

Charge pump seems to be the only signal that turn on and off when mach3 is active.  But as you may have notice in the .xml when mach3 is inactive the change pump pin still floats and needs to be pulled down.  The GT block was just a quick way to demonstrate the concept.
Re: HOW TO DETECT THAT IS RUNNING MACH3 IN POKEYS57CNC
« Reply #17 on: December 06, 2016, 02:39:45 PM »
I'm still mulling over the matter. I have thought that PoKeys57CNC may be periodically checking if there is a Mach3 response. To do this it launches through a shared output (for example through UserDRO (1100)) that will receive Mach3 when it is active.

If Mach3 receives this input, a script (macropump) responds to PoKeys57CNC (for example through the shared output UserDRO (1124)). With this simple code check the operation of Mach3:
If GetUserDRO(1100) = 1 Then   'If I receive a 1 of PoKeys57CNC...
   SetUserDRO(1124, 1)              'Return shipping 1 to Mach3...
   activateSignal(OUTPUT7)         'and activates output 7 to display on the Mach3 diagnostic screen
Else
   SetUserDRO(1124, 0)
   DeactivateSignal(OUTPUT7)
End If

I have some problems that I can not solve:

1. The maximum frequency with which the check is refreshed is 200 ms (time it takes to run the macropump). It's slow, but it might be.
2. The output signal I get in PoKeys57CNC is a square wave of approximately 1.5 Hz and I need to convert it to a logic signal (1 if I have the square wave present and 0 when it disappears). I would like to do it through PoBlocks but I do not see the way to do it.
3. If when I disconnect Mach3 the shared output UserDRO (1124) is at 0, I get a persistent 0 Volts signal at PoKeys57CNC, but if I stayed at 1, I get a high signal. I do not know how to solve it either.

I attached the xml of PoBlocks so that you can understand it better.
« Last Edit: December 06, 2016, 02:43:13 PM by JORATORCA »
Re: HOW TO DETECT THAT IS RUNNING MACH3 IN POKEYS57CNC
« Reply #18 on: December 06, 2016, 02:51:33 PM »
Have you tried this:

1) Open, Pokeys application (should be Pokeys Configuration v4.2.13)
2) To to: Peripherals> Failsafe Settings.
3) Set any pin to the desired failsafe setting.

This will allow the pokeys device to revert to a specific logic value when Mach3 is closed.


I will see if anything comes to mind when taking a look at the .xml you attached
Re: HOW TO DETECT THAT IS RUNNING MACH3 IN POKEYS57CNC
« Reply #19 on: December 06, 2016, 02:52:19 PM »
Make sure you click "send to device" after setting your default failsafe settings.