Hello,
I am having trouble getting the Z-axis to move to safeZ height after implementing a feedhold/halt in Gcode through a C program.
The purpose of the C program is to include thermal protection for the spindle and run the C-program when a thermal switch opens.
The program runs fine except that the spindle does not move up to a safeZ height.
i.e. it executes feedhold and halts the Gcode program and also turns spindle off but it does not raise the spindle.
Actually, it has executed on occasion including safeZ move, but 99% of the time it does not move Z-axis at all.
I can leave it as is but this creates potential to push the run button again, which will simply continue the G code without restarting the spindle. By making a Z-axis move the Gcode will not start without the 'restart' dialogue popup, allowing the user to review conditions and restart the spindle. This is safer, and is what I would like to achieve.
Help with this would be much appreciated.
I am using KStep and Konnect boards with KFlop board.
KMotion435f
Laurence
Halt and safe Z move
Moderators: TomKerekes, dynomotion
Halt and safe Z move
- Attachments
-
- SafeZ_SpindleOff_Thermal_Protect.c
- (610 Bytes) Downloaded 114 times
- TomKerekes
- Posts: 2741
- Joined: Mon Dec 04, 2017 1:49 am
Re: Halt and safe Z move
Hi Laurence,
Are you invoking this from Feedhold or Halt or ??
It might be a race condition. You should not command a Move while a Job is running and moving the Axis. The Code initiates a Feedhold and tells KMotionCNC to Halt. The DoPC Command will return after KMotionCNC has accepted the Halt Command but the Job may not have halted yet. So you might add a delay before commanding Z. Or monitor JOB_ACTIVE until it goes false with:
while (JOB_ACTIVE) ;
HTH
Are you invoking this from Feedhold or Halt or ??
It might be a race condition. You should not command a Move while a Job is running and moving the Axis. The Code initiates a Feedhold and tells KMotionCNC to Halt. The DoPC Command will return after KMotionCNC has accepted the Halt Command but the Job may not have halted yet. So you might add a delay before commanding Z. Or monitor JOB_ACTIVE until it goes false with:
while (JOB_ACTIVE) ;
HTH
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: Halt and safe Z move
Thank you Tom,
Putting in the code:
while (JOB_ACTIVE) ;
did the trick.
Cheers,
Laurence
Putting in the code:
while (JOB_ACTIVE) ;
did the trick.
Cheers,
Laurence
Re: Halt and safe Z move
Tom,
I have attached the updated, and fully operational, C program for any who may be interested.
I have placed it in the 'loop forever' section in my machines Init program to monitor for spindle thermal protection.
Also, I was wondering where I can find a list of all the functions like the JOB_ACTIVE function you provided.
I find most of these simply by searching through the various C programs that are included in the Kmotion download but is there a list with definitions available?
Regards,
Laurence
I have attached the updated, and fully operational, C program for any who may be interested.
I have placed it in the 'loop forever' section in my machines Init program to monitor for spindle thermal protection.
Also, I was wondering where I can find a list of all the functions like the JOB_ACTIVE function you provided.
I find most of these simply by searching through the various C programs that are included in the Kmotion download but is there a list with definitions available?
Regards,
Laurence
- Attachments
-
- SafeZ_SpindleOff_Thermal_Protect.c
- (803 Bytes) Downloaded 116 times
- TomKerekes
- Posts: 2741
- Joined: Mon Dec 04, 2017 1:49 am
Re: Halt and safe Z move
Hi Laurence,
Thanks for posting back.
The files KMotionDef.h and PC-DSP.h list all available defines, variables, and functions for KFLOP. Note you can right click on an include file to open it in the next Thread.
HTH
Thanks for posting back.
The files KMotionDef.h and PC-DSP.h list all available defines, variables, and functions for KFLOP. Note you can right click on an include file to open it in the next Thread.
HTH
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.