Page 1 of 5
MPG with Mach3 using mach3 controls
Posted: Tue Sep 15, 2020 5:14 am
by macona
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.
Re: MPG with Mach3 using mach3 controls
Posted: Tue Sep 15, 2020 2:26 pm
by TomKerekes
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.
Re: MPG with Mach3 using mach3 controls
Posted: Tue Sep 15, 2020 7:14 pm
by macona
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.
Re: MPG with Mach3 using mach3 controls
Posted: Tue Sep 15, 2020 7:48 pm
by TomKerekes
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.
Re: MPG with Mach3 using mach3 controls
Posted: Tue Sep 15, 2020 9:08 pm
by macona
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?
Re: MPG with Mach3 using mach3 controls
Posted: Tue Sep 15, 2020 9:39 pm
by TomKerekes
If you can read the increment you could write it to KFLOP using
this method.
Re: MPG with Mach3 using mach3 controls
Posted: Wed Sep 16, 2020 12:34 am
by macona
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
Re: MPG with Mach3 using mach3 controls
Posted: Wed Sep 16, 2020 3:39 pm
by TomKerekes
Yes you might check the LEDs and determine the Axis number and pass that number in the same way.
Re: MPG with Mach3 using mach3 controls
Posted: Thu Sep 17, 2020 2:26 am
by macona
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
}
Re: MPG with Mach3 using mach3 controls
Posted: Thu Sep 17, 2020 6:35 pm
by TomKerekes
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