Control KStep output with GCode

Moderators: TomKerekes, dynomotion

Post Reply
inwu
Posts: 7
Joined: Fri May 24, 2019 5:37 pm

Control KStep output with GCode

Post by inwu » Fri May 24, 2019 5:51 pm

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?

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

Re: Control KStep output with GCode

Post by TomKerekes » Fri May 24, 2019 6:13 pm

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?
Regards,

Tom Kerekes
Dynomotion, Inc.

inwu
Posts: 7
Joined: Fri May 24, 2019 5:37 pm

Re: Control KStep output with GCode

Post by inwu » Fri May 24, 2019 9:57 pm

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

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

Re: Control KStep output with GCode

Post by TomKerekes » Sat May 25, 2019 3:21 am

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.
Regards,

Tom Kerekes
Dynomotion, Inc.

inwu
Posts: 7
Joined: Fri May 24, 2019 5:37 pm

Re: Control KStep output with GCode

Post by inwu » Sat May 25, 2019 4:07 am

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

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

Re: Control KStep output with GCode

Post by TomKerekes » Sat May 25, 2019 6:36 pm

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?
Regards,

Tom Kerekes
Dynomotion, Inc.

inwu
Posts: 7
Joined: Fri May 24, 2019 5:37 pm

Re: Control KStep output with GCode

Post by inwu » Tue May 28, 2019 10:24 pm

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

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

Re: Control KStep output with GCode

Post by TomKerekes » Wed May 29, 2019 1:24 am

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).
Regards,

Tom Kerekes
Dynomotion, Inc.

inwu
Posts: 7
Joined: Fri May 24, 2019 5:37 pm

Re: Control KStep output with GCode

Post by inwu » Wed May 29, 2019 6:58 pm

Hi Tom,

Thanks for the info. Really appreciate.

Tony

Post Reply