MPG with Mach3 using mach3 controls

Moderators: TomKerekes, dynomotion

macona
Posts: 39
Joined: Tue Sep 15, 2020 4:44 am

MPG with Mach3 using mach3 controls

Post by macona » Tue Sep 15, 2020 5:14 am

So I have been using my kflop for several years now with Mach3 and it still works great, the one thing I miss is my MPG Pendant, it worked with Mach3 though modbus which wont work so well with kflop. So I did a bit of rewiring in the MPG and brought the encoder lines out and connected them to Encoder Channel 0 on JP7 and I can see the lines toggle though the kmotion app. Everything else on the pendant still works though modbus, start/stop/feedhold, FRO, axis select, units.

So my question is, how do I merge the existing mpg .c programs to take the axis and unit selections from Mach3?

-Jerry

Attached a copy of my init file to show where I stand setup wise.
Attachments
InitStepDir3AxisSupermax2.c
(7.42 KiB) Downloaded 100 times

User avatar
TomKerekes
Posts: 2677
Joined: Mon Dec 04, 2017 1:49 am

Re: MPG with Mach3 using mach3 controls

Post by TomKerekes » Tue Sep 15, 2020 2:26 pm

Hi Jerry,

The simplest thing would be to also wire the axis select and units to KFLOP as well and use the example: MPGServiceSmoothHardwareEncFilteredRev3.c

I suppose you could have Mach3 read those inputs and write them to Virtual Bits in KFLOP using a Macro Pump in Mach3 but that would be more complicated.
Regards,

Tom Kerekes
Dynomotion, Inc.

macona
Posts: 39
Joined: Tue Sep 15, 2020 4:44 am

Re: MPG with Mach3 using mach3 controls

Post by macona » Tue Sep 15, 2020 7:14 pm

That would mean I would have to buy a new pendant. The pendant has an internal microcontroller which reads the switch positions and sends that via modbus serial to mach3. I used up any extra wires routing out the encoder.

User avatar
TomKerekes
Posts: 2677
Joined: Mon Dec 04, 2017 1:49 am

Re: MPG with Mach3 using mach3 controls

Post by TomKerekes » Tue Sep 15, 2020 7:48 pm

Maybe you could use a Mach3 Brain to read the Modbus bit and write it to a Mach3 Output Pin which is configured as a KFLOP Virtual Bit.
Regards,

Tom Kerekes
Dynomotion, Inc.

macona
Posts: 39
Joined: Tue Sep 15, 2020 4:44 am

Re: MPG with Mach3 using mach3 controls

Post by macona » Tue Sep 15, 2020 9:08 pm

Would there be a way to read whatever oem LED changes and whatever DRO handles the increment on the screen and feed that into kflop somehow?

User avatar
TomKerekes
Posts: 2677
Joined: Mon Dec 04, 2017 1:49 am

Re: MPG with Mach3 using mach3 controls

Post by TomKerekes » Tue Sep 15, 2020 9:39 pm

If you can read the increment you could write it to KFLOP using this method.
Regards,

Tom Kerekes
Dynomotion, Inc.

macona
Posts: 39
Joined: Tue Sep 15, 2020 4:44 am

Re: MPG with Mach3 using mach3 controls

Post by macona » Wed Sep 16, 2020 12:34 am

Looks like I can read DRO 828 to get that info. OEM Leds 400,402,404,406,408,410 for Axes X,Y,Z,A,B,C.

How would I pass LEDs? same way?

-Jerry

User avatar
TomKerekes
Posts: 2677
Joined: Mon Dec 04, 2017 1:49 am

Re: MPG with Mach3 using mach3 controls

Post by TomKerekes » Wed Sep 16, 2020 3:39 pm

Yes you might check the LEDs and determine the Axis number and pass that number in the same way.
Regards,

Tom Kerekes
Dynomotion, Inc.

macona
Posts: 39
Joined: Tue Sep 15, 2020 4:44 am

Re: MPG with Mach3 using mach3 controls

Post by macona » Thu Sep 17, 2020 2:26 am

So I can do something like this in Mach

GetOEMDRO(828) 'Put a value in a Mach DRO
NotifyPlugins(19007) 'Send it to KFLOP
GetOEMLED(400)
NotifyPlugins(19008)
And so on...

And then in the notify program:

#include "KMotionDef.h"
#define DROIN 7
#define LEDIN 8
main()
{
do stuff
}

User avatar
TomKerekes
Posts: 2677
Joined: Mon Dec 04, 2017 1:49 am

Re: MPG with Mach3 using mach3 controls

Post by TomKerekes » Thu Sep 17, 2020 6:35 pm

Hi Jerry,

I believe:

Code: Select all

GetOEMDRO(828) 'Put a value in a Mach DRO
Gets the increment but doesn't put it anywhere. I think you would need something like:

Code: Select all

Increment = GetOEMDRO(828) 'Get Increment
SetOEMDRO(1007, Increment) ' put it in User DRO 7
NotifyPlugins(19007) 'Send it to KFLOP
You would need to do something similar with the LEDs. I was thinking that sending the axis number would be more efficient. Something like

Code: Select all

If (GetOEMLED(400) = 1) Then Axis = 0
else If (GetOEMLED(401) = 1) Then Axis = 1
else If (GetOEMLED(402) = 1) Then Axis = 2
else If (GetOEMLED(403) = 1) Then Axis = 3
else Axis = 4

SetOEMDRO(1008, Axis) ' put it in User DRO 8
NotifyPlugins(19008) 'Send it to KFLOP
HTH
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply