Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: pjd on July 02, 2010, 08:16:39 PM

Title: Dual function for MPG?
Post by: pjd on July 02, 2010, 08:16:39 PM
Hi All,

Does anyone know if the MPG can also be used as a Feedrate Override?  I am hoping to optimise on the inputs I have available on a new controller and want to implement a Feedrate Override knob.  Since I have an MPG wheel, and since this is used only for manual positioning, and not used when a program is running, it would be really cool if it's function could be switched from MPG jog to F/R Override.  Does anyone have any ideas on if or how this could be accomplished?
Title: Re: Dual function for MPG?
Post by: Tarak on July 04, 2010, 02:56:53 AM
Good call, I like the idea, I'd also be keen to know if it can be done.
Title: Re: Dual function for MPG?
Post by: BR549 on July 04, 2010, 12:43:49 PM
It has already been done I believe Jeff Birt has the Plugin to do it but I don't think it is free(;-)
Title: Re: Dual function for MPG?
Post by: BR549 on July 04, 2010, 01:13:11 PM
SHould be possible from a BRAIN as well. Let us know if you want to try it I may have time to work on it.
Title: Re: Dual function for MPG?
Post by: pjd on July 04, 2010, 05:34:36 PM
Thanks for your replies.   
Yes I am very keen to try it, but I have absolutely no experience with working with a BRAIN (not even sure I have one!) but willing to try anything once!  Thanks for your offer, and if you can I really would appreciate it.  I know time is a valuable commodity so if you can't find the time I am quite happy to do the work if you can give me a direction and some hints and pointers along the way.
Cheers.
Title: Re: Dual function for MPG?
Post by: BR549 on July 04, 2010, 05:43:20 PM
OK how are you using your mpg now its it hooked directly to the LPT port? is it MPG0 ,1,2 ? Do you have selector switches for its use?
Title: Re: Dual function for MPG?
Post by: pjd on July 04, 2010, 06:22:23 PM
I am using it through Greg's Smoothstepper board, coming in on Port3 as MPG1.  I have my own FPGA a little further downline from Gregs in which I can enable or disable the MPG signals depending on the mode (lock it out when in Auto).  This mode signal also comes back to Port 2 input pin to select MPG jog mode.
Title: Re: Dual function for MPG?
Post by: BR549 on July 04, 2010, 09:48:29 PM
So you are familar with mach(;-) well basically you take the mpg counts and use a divisor and apply the numer to the FRO dro. So when the count goes up the FRO goes up and if the count goes down the FRO goes down.
Title: Re: Dual function for MPG?
Post by: pjd on July 04, 2010, 10:25:22 PM
Well, sort of familiar ....Can set up OEM codes to inputs and played a little with basic Macros, but unfortunately that is about it.  With this I can see your point, that is very clever, and it does sound quite easy in principle, but if we were to go with a macro then it would have to be triggered  (I don't know how a brain would handle it!). 

I do have one spare input pin, so if I couple that to an edge trigger on the MPG so as to pulse the spare input on each transition, that could call the macro to update the FRO.  I'll get on to it and see I can come up with.   

BTW, what is the best way to trigger a Macro from an input transition??

Cheers

Title: Re: Dual function for MPG?
Post by: BR549 on July 05, 2010, 10:46:32 AM
The macropump is simple but slow, Brains are much faster but not as simple.
Title: Re: Dual function for MPG?
Post by: pjd on July 05, 2010, 05:51:58 PM
I tried writing a small macro to do what you said and it does work, move the MPG, run the Macro and the FRO changes...Perfect!!  So far so good!  Saved it as a macropump and it sort of worked but as you say, very slow and erratic.  

So, now we have proven the principle, how can we implement it in a Brain?   I think the two main conditions  for this are:

1) Needs to work based on the condition of an input pin.
2) FRO should not be allowed to go below zero

In the macro I could only get it to work by storing the MPG count to use as the reference for the next cycle, since we need to determine the change in MPG DRO.  Can this be implemented in a brain?

The other way I could see it working is to trigger a Macro from another input pin, but how can you call a Macro from an input?

Cheers
Title: Re: Dual function for MPG?
Post by: BR549 on July 05, 2010, 06:21:10 PM
In a brain I think I would input the MPG count and use a divisor(depending on the counts per of the MPG) on the number to make the ouput have more resolution and make the FRO react slower to MPG input.

Then route that number out to the FROdro "IF" a condition was met say an input is active as you require. That way you can turn it on and off when needed. You could also use an LED and turn it off from the Keyboard or Hotkey.
Title: Re: Dual function for MPG?
Post by: pjd on July 05, 2010, 06:29:17 PM
Sounds good to me, so now the big question is how do I write a brain?
Title: Re: Dual function for MPG?
Post by: BR549 on July 05, 2010, 06:57:27 PM
There IS a video in the video section(;-)