Page 1 of 1

Beginner: Connecting a standard MPG to KFlop/KStep

Posted: Sat Feb 29, 2020 3:02 pm
by GS76
Hi all,

I want to connect a standard MPG to the KFlop, please see the wiring description/diagram in the attachment. I am using it on my 3-axis milling machine with a spindle, KStep driving the stepper motors.

I am not an electronic technician/engineer, so I would require a KISS description, please!!

Thank you.

Re: Beginner: Connecting a standard MPG to KFlop/KStep

Posted: Sat Feb 29, 2020 4:29 pm
by TomKerekes
See here.

Re: Beginner: Connecting a standard MPG to KFlop/KStep

Posted: Sun Mar 01, 2020 6:59 am
by GS76
Thank you, Tom,

However, I still do not know where to start.

Let me explain my confusion:

1. "JP7 - GPIO" is used to connect to KStep. Therefore, should I use JP4 or JP6 pin-outs?
KFlop_Pinouts.PNG
2. Where do I assign the pinouts and which c code sample could I use? See below.
MPG c examples.PNG
The KFlop and KStep are excellent, and I am delighted to have purchased it. However, it is not always easy to set-up as a beginner.

Any further assistance would be much appreciated.

Regards,

Gary

Re: Beginner: Connecting a standard MPG to KFlop/KStep

Posted: Sun Mar 01, 2020 4:57 pm
by TomKerekes
Hi Gary,
1. "JP7 - GPIO" is used to connect to KStep. Therefore, should I use JP4 or JP6 pin-outs?
Yes. Let's assume you use JP6

2. Where do I assign the pinouts and which c code sample could I use? See below.
The first step is to decide whether you want to use a KFLOP hardware encoder input (and if one is available) or whether you will count the MPG pulses in software. Hardware is better and faster but requires connection to dedicated pins on KFLOP. With software any inputs can be used.

Let's assume hardware. The following code (from the MuxEncoders.c example) will move 4 encoder inputs to JP6:

Code: Select all

	// Mux encoder inputs from KFLOP JP5 to JP6
	FPGAW(ENC_NOISE_FILTER_ADD) = ENC_4_7_JP6 + ENC_NOISE_FILTER_DEFAULT_VAL; 
Inputs IO26 and IO27 will now cause encoder channel 4 to count. So connect the MPG A B signals to these inputs. Configure some KFLOP axis (I'll assume you choose Axis 4) as Encoder Input Mode and Input Channel 0 = 4. After this the Axis Screen should show the Axis 4 Position changing when the MPG is rotated.

Here is something similar from one of the Wiring diagrams in the wiki (KFLOP+SnapAmp DC Brush Motors with MPG). Note some of the wire colors and signals are different from yours but you should be able to get the idea:

MPG-JP6.png

MPGServiceSmoothHardwareEncFilteredRev3.c is probably the best example. Modify the defines for your situation. Then include the modified program into your Initialization C Program and add a call to the ServiceMPG() from your forever loop.

HTH

Re: Beginner: Connecting a standard MPG to KFlop/KStep

Posted: Sun Mar 01, 2020 5:32 pm
by GS76
Thank you Tom,

I will try this out and let you know if I have trouble.

Sorry one other thing quickly, where can I purchase a male plug for JP6 or JP4?

Thank you very much.

Re: Beginner: Connecting a standard MPG to KFlop/KStep

Posted: Sun Mar 01, 2020 5:37 pm
by TomKerekes
Hi Gary,

See the wiki. But I think you want a female connector.

Re: Beginner: Connecting a standard MPG to KFlop/KStep

Posted: Sun Mar 01, 2020 5:48 pm
by GS76
Thank you Tom,

Much appreciated.

Re: Beginner: Connecting a standard MPG to KFlop/KStep

Posted: Wed May 27, 2020 5:36 pm
by Jungeljon
Is it possible to use momentary switches for x1 x100 & XYZ select? Or does the program need an logic high or low trough out the whole procedure?

Re: Beginner: Connecting a standard MPG to KFlop/KStep

Posted: Wed May 27, 2020 7:08 pm
by TomKerekes
Hi Jungeljon,

The MPG C programs normally expects the inputs to be set while moving to set the Factor of movement. You could change it to "remember" the last button pushed by simply not changing the Factor unless an input is active.

HTH