MPG and MUX definitions

Moderators: TomKerekes, dynomotion

Dennis Johnson
Posts: 11
Joined: Fri Nov 24, 2023 3:12 pm

MPG and MUX definitions

Post by Dennis Johnson » Fri Jun 13, 2025 1:34 pm

Hi all,

I'm trying to interface a single ended encoder for an MPG handle.

I understand that a "mux" statement must be used in my init.c file. 4 questions:

1 Can I modify the mux statement to include only one encoder multiplexed to one set of pins on jp6. I think I would need something like:


// Mux encoder inputs from KFLOP JP7 & JP5 to JP4 and JP6
FPGAW(ENC_NOISE_FILTER_ADD) = ENC_7_JP6 + ENC_NOISE_FILTER_DEFAULT_VAL;

if this is correct, which pins on jp6 would i use for MPG phase A and B?

2 How can I test if this is working, not sure how to assign a dro to simply look and see if the single ended MPG incoder is working?

3 Does the mux statement belong in the setup portion of the C program or loop?

4 I think I have to also include a statement in the C to invoke the MPG to start counting, again "setup" or "loop"?

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

Re: MPG and MUX definitions

Post by TomKerekes » Fri Jun 13, 2025 4:08 pm

Hi Dennis,
I understand that a "mux" statement must be used in my init.c file. 4 questions:
If you wish to use connector JP4 instead of JP7 or JP6 instead of JP5 you can use the mux.

Can I modify the mux statement to include only one encoder multiplexed to one set of pins on jp6. I think I would need something like:


// Mux encoder inputs from KFLOP JP7 & JP5 to JP4 and JP6
FPGAW(ENC_NOISE_FILTER_ADD) = ENC_7_JP6 + ENC_NOISE_FILTER_DEFAULT_VAL;


if this is correct, which pins on jp6 would i use for MPG phase A and B?
No. There isn't the option to move individual encoder inputs. The only options are to move all 4 encoder inputs from JP7 to JP4 and/or all 4 encoder inputs from JP5 to JP6. Note because encoder signals are inputs, pins can still be used as general purpose IO if the encoder channels are not needed.

To use JP6 code:

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;
When JP4 or JP6 are used the 4 AB encoder inputs occupy the first 8 inputs on the connector in logical order.

For JP6 encoder #4 would have its A signal on IO26 Pin5 and IO27 Pin6

How can I test if this is working, not sure how to assign a dro to simply look and see if the single ended MPG incoder is working?
Configure an axis to have Input mode encoder and configure the Input Channel 0 to the Encoder Input Channel (4). After KFLOP is configured the Encoder count can be viewed on the KMotion.exe Axis Screen. You might also check that IO26 and 27 toggle on KMotion's Digital IO Screen when the encoder is moving.

3 Does the mux statement belong in the setup portion of the C program or loop?
The setup portion
Regards,

Tom Kerekes
Dynomotion, Inc.

Dennis Johnson
Posts: 11
Joined: Fri Nov 24, 2023 3:12 pm

Re: MPG and MUX definitions

Post by Dennis Johnson » Mon Jun 16, 2025 1:14 pm

Thanks for the response Tom,

My reason to want to move only one enxoder to JP6, the lathe I'm working on will eventually have 6 axis of coordinated movement using differential. I want to start the retro simple at first, two axis. I want to reserve every differential input I have for the other axis to be added in the future.

I'm guessing I will need to purchase a differential MPG encoder to work with the Kanalog board or purchase an off the shelf converter.

Is there any way to fake a single end signal without having to purchase additional hardware? Pull up, Pull down, capacitor, If I move the single ended mpg handle, it it will count, but only after hitting reset (init.c) and this includes moving an axis motor with differentiall output, that's connected properly. To be more clear, I have one axis motor connected to JP1 channel 0 (encoder only), and when I turn the motor shaft the DRO doesn't count live changes, but will wait for the reset to register the counts, just like the single ended mpg I have connected to JP2 channel 7.

I may be expecting the wrong response, I have only used kflop\kanalog with mach 3 interface and don't really know if the motor shaft movement without being commanded, will actually live change the DRO without a commanded position.

Thanks in advance, as always I appreciate all of your help.
Dennis

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

Re: MPG and MUX definitions

Post by TomKerekes » Mon Jun 16, 2025 8:09 pm

I'm guessing I will need to purchase a differential MPG encoder to work with the Kanalog board or purchase an off the shelf converter.
I think those would be the best solutions. Converters are inexpensive such as this.

Is there any way to fake a single end signal without having to purchase additional hardware? Pull up, Pull down, capacitor
You could use an inverter. Or a differential line driver :)

If I move the single ended mpg handle, it it will count, but only after hitting reset (init.c) and this includes moving an axis motor with differentiall output, that's connected properly. To be more clear, I have one axis motor connected to JP1 channel 0 (encoder only), and when I turn the motor shaft the DRO doesn't count live changes, but will wait for the reset to register the counts, just like the single ended mpg I have connected to JP2 channel 7.
I'm not sure I understand. Are you looking at KMotionCNC DROs? Or KMotion Axis Screen? For an axis to count encoder pulses it must be configured as Input Mode Encoder and the correct encoder channel specified.

For KMotionCNC to display encoder positions it must be configured to display Encoder position rather than commanded Destination. (Blue DRO). See here.
Regards,

Tom Kerekes
Dynomotion, Inc.

Dennis Johnson
Posts: 11
Joined: Fri Nov 24, 2023 3:12 pm

Re: MPG and MUX definitions

Post by Dennis Johnson » Sun Jul 13, 2025 5:44 pm

Thanks of the help Tom,

I received the converters and configured the cnc app to see encoder counts live. Can't seem to be able to move the encoder to input 7 in a 3 axis screen.

I discovered all of my brushless amps have been contaminated with rat piss and all are faulty, note to self, rat proof EVERY electronic enslosure... since I will have to replace all the amps, I'm considering the snap Amp (s). I see they are only capable of 80v input, does this mean I'll have to replace all my motors too, as they are 200 volt 500w motors, with lower voltage ones? If so, any suggestions? I can replace the 3 amps for about $1600 and use the motors I have.

Thanks
Dennis

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

Re: MPG and MUX definitions

Post by TomKerekes » Mon Jul 14, 2025 4:39 pm

Hi Dennis,
Can't seem to be able to move the encoder to input 7 in a 3 axis screen.
Why not? Did you set the input channel for an axis to 7?

I'd suggest keeping your existing motors that way you can keep your existing wiring, power supplies, EStop etc.
Regards,

Tom Kerekes
Dynomotion, Inc.

Dennis Johnson
Posts: 11
Joined: Fri Nov 24, 2023 3:12 pm

Re: MPG and MUX definitions

Post by Dennis Johnson » Mon Jul 14, 2025 4:57 pm

Thanks Tom,

I did set my input to 7 when I had the encoder hooked to #7, Not shure what I did wrong but I'll try again.

On the wiring, limit switches, I am in the early stages of this retrofit so all that stuff isn't installed yet, I always lay the components out on a table and get it running before mounting it so price is my main concern at this moment, of course I'm looking for the same performance I have on a mill with identical motors/amps (yaskawa usarem-05ae1xxx and CACR-SR05xxxx or 500 watt 200 volt).

So again, what is the max voltage the SnapAmps will output, and if it's only 80v, are there brushless motors you have seen used, to get the max out of your Snapamps?

Dennis

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

Re: MPG and MUX definitions

Post by TomKerekes » Tue Jul 15, 2025 1:17 am

Hi Dennis,

Yes SnapAmp's maximum supply voltage is 80V so ~70V can actually be supplied to the motor. It can work with higher voltage motors with the same torque but depending on the motor BackEMF it may not be able to run at the maximum RPM.

Also be aware that lower voltage motors need higher currents for the same torque which can make wiring/grounding challenging. Especially since SnapAmp is not optically isolated.

We don't buy motors. But I see Anaheim Automation has some lower voltage motors:
https://anaheimautomation.com/brushless ... ors/blf60/
Regards,

Tom Kerekes
Dynomotion, Inc.

Dennis Johnson
Posts: 11
Joined: Fri Nov 24, 2023 3:12 pm

Re: MPG and MUX definitions

Post by Dennis Johnson » Tue Jul 15, 2025 1:30 am

Thanks Tom for your response and patience.

I think I'm hearing you say I may be able to use the 200v motors I have, with less speed.

On the assigning input channels to axis channel, I can assign 0-3 to any of the 3 axis I have active currently. When I set it up with 4-7, nothing. Looking at the Digital I/O page, the KFLOP tab only shows 0-3 encoders. Goes right into home and limit switches after that. Even if I go to the Kanalog tab I see no change in any of the I/O's change state when moving the encoder.

Again, Thank YOU
Dennis

Dennis Johnson
Posts: 11
Joined: Fri Nov 24, 2023 3:12 pm

Re: MPG and MUX definitions

Post by Dennis Johnson » Tue Jul 15, 2025 1:38 am

Also, will the kflop use resolver input instead of encoder to close a position loop?

Post Reply