I also have the 4th axis rotary.
Hi Robert,
It is intended for when you want to make a New C Program staring from scratch. This is not common.In my effort to better understand the KMotion.exe I'm hoping you can shed some light on some questions.
In the CProgram screen there is a "New" button. When do you use this?
It will create an empty program with the name UserX.c where X is the current Thread number you have selected. It warns you that any file you might have had named UserX.c will be overwritten.If I press it it states that it will overwrite something. What does that mean?
It will overwrite the disk file UserX.c. with basically an empty program shell and the screen will then show that file. Normally after creating the program you would "SaveAs" to a name that would make sense for you. None of this has any immediate effect on the Threads in KFLOP. It is similar to using notepad to edit files on your disk. Until you do something to Compile/Download the File to KFLOP.Overwrite what I see on the screen or overwrite the program in the computer files?
That is correct. This is the same as opening a file with Microsoft Word. If you delete everything and select "Save" the disk file ill then be an empty file. What might be confusing is that you are saving the file without realizing it by pushing the Save or Save/Compile/Download/Execute button. If you want to edit things without changing a particular disk file first save it with a new name.Also, I've noticed that if I highlighted and deleted anything that is on the CProgram Threads screen, it not only clears the screen it also clears program from the computer file location. The name of the file is still listed but it contains no coding. Why is that? Normal?
I'm not sure what K2CNC did. But I showed you what they typed into the file:Do you know if K2 flashed into memory any of the other Threads besides the K2mc_driver.c?
// - K2mc_driver.c -> Thread 6
// - homing.c -> Thread 5
// - toolchange.c -> Thread 4
// - bitJog_sLimit.c -> Thread 1
I believe they are saying that those files should be compiled, downloaded, and Flashed into those KFLOP Threads. This comment might not be up to date.
Again the comment might be old or they might always set that up for every machine whether they have certain features.I wonder why the tool changer thread is listed. We don't have a tool changer.
HTH
Regards
Regards
TK http://dynomotion.com
I also have the 4th axis rotary.
Tom,
That helped a lot! I was able to confidently delete the duplicate program from thread #7. I also tried a different configuration of Threads and put the K2_SpindlePWM.c program on a thread line. Just to see what would happen. This was my configuration but nothing changed. Spindle still not turning. Since I do not have a tool changer I replaced it with the spindle program and moved what was in line 4 onto line 7. All axis' work, Homing works but spindle still does not turn on when called.
Thread line up:
#1 bitJog_slimit.c
#2 InitStepDir3Axis.c
#3 StopCallBack.c
#4 K2_SpindlePWM.c
#5 homing_zyx.c
#6 k2mc*_driver.c
#7 SetStepPulseLength.c
Thanks again for answering my other questions. I was wondering if you could shed some light on when to use the "recovery" button in config/flash screen? Does it also restore Threads?
Robert
Robert,
When you did this and compiled the programs did you download them into KFLOP? Also if you moved the spindle program to thread #4, make sure you update KmotionCNC for spindle to look in thread #4 originally I think it was in thread two if I recall correctly.
Also on the init button in KmotionCNC, you now have that in thread #2 make sure you adjust that change in KmotionCNC as well. After you do that you might want to press the init button and then try to issue some spindle commands again.
Does the relay still click when you issue the command M3 S9000 ???
Russ
Russ
Hi Russ,
Yes, I did change all the threads from 2 to 4 in the tool set up and also changed the command speed. Nothing changed. Also, M3 and M5 on/off clicking still working and the display on the VFD still says run when M3 is clicked and off with M5 is clicked.
I also tried changing all the Threads back to what I think was originally loaded and just adding the spindle program to Thread 7. - tested and then changed the all the thread calls from 2 to 7 in the tool set up screen. Nothing different.
Robert
Robert,
Run an experiment, first start up Kmotion.exe, then after that is running minimize it and then start up KmotionCNC.exe and go ahead and hit the init button. Before you do anything else look back at the console page on Kmotion.exe do you see any messages? Now try the M3 S9000 in KmotionCNC and then check Kmotion.exe console again, any messages?
Tom,
Is there anyway to determine what is downloaded in KFLOP and ready to run? I would have thought after he upgrade the Kflop to new firmware it would have removed all flashed programs? Not sure how it is getting initialized and how M3, M4, M5 are working without some code resident in KFLOP still?
Russ
OK, So This is what happened:
Thu, Jul 23, 2015, 02:15:03 KMotion Program Started
Spindle Set to 0.000000 pwm 255
The first line was there when I opened it, nothing changed when I hit "Init", then the second line appeared when I entered M3 S9000.
By the way, just for clarity, I restored all of the Threads to what I had the other day before I did this test.
Robert
Robert,
This seems to suggest that the PWM program is not adjusting the signal. It is saying it is set to 0, so clearly the issue has to do with the fact when you type in S and a speed number it is nothing getting there.
Russ
Robert,
Clearly the routine is getting called but "speed" does not appear to be getting passed. You could add a few more printf in the program but the speed variable seems to be the issue. You could prove this by hard coding a speed in the code and compile and download and when you call the spindle would turn on, just a test.
Russ
#include "KMotionDef.h"
#define MAX_RPM 18000.0f
#define PWM_NUMBER 5 //0-7
#define pdSpindleRPM 35
//#define INVERT
main()
{
int pwm;
float speed = *(float *)&persist.UserData[pdSpindleRPM]; // value stored is actually a float
pwm = speed/MAX_RPM * 255.0f;
if (pwm > 255) pwm=255; // limit to max pwm value
#ifndef INVERT
pwm = 255 - pwm; // set the PWM
#endif
//pwm = 128;//165-175
printf("Spindle Set to %f pwm %d\n",speed, pwm); // print the desired speed
SetBitDirection(26+PWM_NUMBER,1); // Set bit PWM pin as an output
FPGA(IO_PWMS+2*PWM_NUMBER+1) = 1; // enable the PWM
FPGA(IO_PWMS+2*PWM_NUMBER) = pwm; // set the PWM
}
Hi Robert,
Do you have the Var configured for 35 as the C Program is expecting in the KMotionCNC Tool Setup S?
Regards
Regards
TK http://dynomotion.com
Tom,
Great catch, NO he has the VAR on the KmotionCNC set to VAR 31.
Robert you can change this on the KmotionCNC screen look at the S command that call the Spindle routine and based on the screenshots you sent earlier the VAR for spindle is setup for 31, change that to 35 and it should start working.
Russ
Tom and Russ,
I just tested it after changing the VAR from 31 to 34 with out any luck. I noticed that M4 also lists VAR 31 so I tried changing that one as well with out a change.
Robert
Sorry, I meant VAR 35 not 34.
However, the console now says this!
Fri, Jul 24, 2015, 01:08:10 KMotion Program Started
Spindle Set to 9000.000000 pwm 128
Tom,
Should the M4 also be VAR 35?
Robert
Russ,
Retested ACM/AUI pins for voltage for S3000, S6000 and S9000. Still reading same for all - 0.067 DVC
Retested Aux1-Pin 11 Still reading 0.5 DVC
Robert
Robert,
I actually think what they have listed for the two C programs for M3, M4, and M5 are not actually what they are using. M4 is not really required at all unless you plan on running the spindle in reverse. Some actual CNC machines implement the M4 command for rigid tapping. The turn the spindle slowly forward to turn in the tap, stop, reverse the motor and remove the tap. This is the most common use of M4, there are some reverse cut bits that are designed for the spindle to run CCW but they are rare.
what you would normally do is configure the M3 command to set bit 34 to a 1, and M5 command would set bit 35 to a 0.
The fact that Kmotion now is printing out the the console the spindle is set to a given RPM and PWM signal is good. Are you still hearing the relay click when you issue the M3 command? Keep in mind the spindle will not turn even in you have the speed signal if the M3 command does not close the relay. Did this spindle ever work correctly? If the relay is indeed closing and the PWM signal is really there we need to troubleshoot the components that convert the PWM signal into a analog voltage. With Spindle set at 9000 RPM the voltage going to the spindle should actually be 5V.
Russ
Robert,
Correction to my last post, M3 and M5 should be controlling bit 34.
Russ
Hi Robert,
KFLOP Aux1-Pin 11 is PWM generator #4
Your Spindle C Program is specifed to use PWM #5
Regards
Regards
TK http://dynomotion.com
Robert,
JP6 - AUX1
PIN-12
IO31
Gen Purpose LVTTL I/O (3.3V Only) or PWM5 out
Check this pin to see if you have a voltage between Pin-12 and GROUND.
Russ