Page 1 of 1

Control KStep output with GCode

Posted: Fri May 24, 2019 5:51 pm
by inwu
I have a KFLOP & KSTEP HW configuration and I am using Mach3 to control the board. Right now, I am trying to use KSTEP's relay output to control the laser module and wondering how It can be done? Actually, my question is how KFLOP can receive Mach3 GCode command and toggling the the relay output? Also, is it possible to do PWM on the relay output?

Re: Control KStep output with GCode

Posted: Fri May 24, 2019 6:13 pm
by TomKerekes
Hi inwu,

KSetp's relay outputs are connected to KFLOP IO Bits 0 and 1. Configure as outputs and change their state in the KMotion Digital IO Screen to test. You can then configure those as Outputs in Mach3 if you wish. See Within Mach3 - configure IO Bits.

Regarding PWM:KFLOP IO bits 0 and 1 do not have an option for PWM. Only KFLOP IO 26-33 or 44 can be configured as PWM outputs. Also the relay driver opto coupler may not be fast enough for PWM depending on your requirements. What are your requirements for the PWM in terms of voltage and frequency?

Also how fast does the Laser command need to be synchronized to motion.

Have you considered using KMotionCNC?

Re: Control KStep output with GCode

Posted: Fri May 24, 2019 9:57 pm
by inwu
Hi Tomkerekes,

Thanks for your reply. I am a newbie on this, so please excuse me if I ask anything stupid.

I just found out that in the KMotion Tool setup screen, you can configure M100-199 for custom purpose. I assume this is the way that I should use.

As for the PWM, I maybe able to use IO26-33 to do it. Could you tell me how to configure it or point me to the right document?

Thanks in advance

Re: Control KStep output with GCode

Posted: Sat May 25, 2019 3:21 am
by TomKerekes
I just found out that in the KMotion Tool setup screen, you can configure M100-199 for custom purpose. I assume this is the way that I should use.
Did you mean the KMotionCNC | Tool Setup Screen? Are you switching from Mach3 to KMotionCNC?
As for the PWM, I maybe able to use IO26-33 to do it. Could you tell me how to configure it or point me to the right document?
Please read this wiki article and let us know what parts you understand.

Re: Control KStep output with GCode

Posted: Sat May 25, 2019 4:07 am
by inwu
Hi Tom,

I am confused by the KMotion and KMotionCNC. (I think they are the same thing) So my question is still the same. What G Code can I use in Mach3 to notify KFLOP to toggle the I/O?

Thanks

Re: Control KStep output with GCode

Posted: Sat May 25, 2019 6:36 pm
by TomKerekes
Hi inwu,
I am confused by the KMotion and KMotionCNC. (I think they are the same thing)
No they are different.

KMotion.exe is our executive program to configure KFLOP and to test and tune your hardware.

KMotionCNC.exe is our free CNC program similar to Mach3.
So my question is still the same. What G Code can I use in Mach3 to notify KFLOP to toggle the I/O?
The simplest would probably be to treat your Laser like turning on and off a Spindle with M3 and M5.

Did you read the link from the previous post?

Re: Control KStep output with GCode

Posted: Tue May 28, 2019 10:24 pm
by inwu
Hi Tom,

Thanks for your help. I will need time to digest all the information that you provide me. I did some research myself and seems like the question I asked is more related to Mach3 than KMotion. My understanding is first map KMotion I/O to Mach3, and then use Mach3's custom M command with script to communicate with KMotion.

Tony

Re: Control KStep output with GCode

Posted: Wed May 29, 2019 1:24 am
by TomKerekes
Hi Tony,
I did some research myself and seems like the question I asked is more related to Mach3 than KMotion. My understanding is first map KMotion I/O to Mach3, and then use Mach3's custom M command with script to communicate with KMotion.
That is one approach. Another approach is to process Spindle Messages generated by Mach3. These messages are sent by Mach3 to our Plugin which can then send the messages to a C Program that you create. In this approach Mach3 IO bits or Mach3 Scripts aren't usually required. The KFLOP C Program can just perform whatever hardware operation needed. Here is an excerpt from the previous link posted.

Mach3 generates Spindle Messages for On, Off, and Speed Changes. Specify a KMotion Spindle Speed User Program to handle and perform appropriate actions for the various Mach3 Spindle Messages. A default SpindleMach3.c program is included in the default installation that will simply print the messages and desired speeds requested by Mach3. Note that speed is a relative fraction of the max currently selected pulley's speed. Because KFlop/KMotion is likely to be controlling the motor speed regardless of the selected pulley, this is usually more appropriate. An appropriate User Program to perform the appropriate actions to actually drive the spindle should be created to replace the default program that simply prints the requested operation. There are included examples for Spindles controlled by a DAC output (SpindleMach3DAC.c) and for Spindles controlled by Step/Dir outputs (SpindleMach3Jog.c).

Re: Control KStep output with GCode

Posted: Wed May 29, 2019 6:58 pm
by inwu
Hi Tom,

Thanks for the info. Really appreciate.

Tony