Control KStep output with GCode
Moderators: TomKerekes, dynomotion
Control KStep output with GCode
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?
- TomKerekes
- Posts: 2676
- Joined: Mon Dec 04, 2017 1:49 am
Re: Control KStep output with GCode
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?
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?
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: Control KStep output with GCode
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
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
- TomKerekes
- Posts: 2676
- Joined: Mon Dec 04, 2017 1:49 am
Re: Control KStep output with GCode
Did you mean the KMotionCNC | Tool Setup Screen? Are you switching from Mach3 to KMotionCNC?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.
Please read this wiki article and let us know what parts you understand.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?
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: Control KStep output with GCode
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
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
- TomKerekes
- Posts: 2676
- Joined: Mon Dec 04, 2017 1:49 am
Re: Control KStep output with GCode
Hi inwu,
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.
Did you read the link from the previous post?
No they are different.I am confused by the KMotion and KMotionCNC. (I think they are the same thing)
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.
The simplest would probably be to treat your Laser like turning on and off a Spindle with M3 and M5.So my question is still the same. What G Code can I use in Mach3 to notify KFLOP to toggle the I/O?
Did you read the link from the previous post?
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: Control KStep output with GCode
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
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
- TomKerekes
- Posts: 2676
- Joined: Mon Dec 04, 2017 1:49 am
Re: Control KStep output with GCode
Hi Tony,
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).
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.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.
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).
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: Control KStep output with GCode
Hi Tom,
Thanks for the info. Really appreciate.
Tony
Thanks for the info. Really appreciate.
Tony