KFLOP STOP and logic outputs to control amplifiers

Moderators: TomKerekes, dynomotion

Post Reply
Mateusz
Posts: 31
Joined: Thu Jun 06, 2019 8:36 pm

KFLOP STOP and logic outputs to control amplifiers

Post by Mateusz » Thu Jun 13, 2019 10:26 pm

Hi Tom

Another issue I don't know how to overcome, I remember I saw on old forum similar problem, but I can not find it any more.
I'm using watchdog on thread 7, and when I hit ESC button on keyboard or press STOP / abort all motion on the KmotionCNC screen. KFLOP goes to stop mode. All threads are stopped as well of course, in that case how I can clear bits responsible for physical axis enabling. In this situation my servos are drifting slowly in one direction due to near zero analog output. Till I will initialise KFLOP. This is very dangerous and I'm sure must be the way to resolve this.

#include "KMotionDef.h"

main()
{
for (;;) // repeat forever
{
WaitNextTimeSlice(); // execute one loop per time slice

// check if all axes are enabled and other signal like E-stop, system pressure, XYZ ready signal.....
if ((ch0->Enable) & (ch1->Enable) & (ch2->Enable)
& ReadBit(1025) & ReadBit(1026) & ReadBit(1027) & ReadBit(1028) & ReadBit(1029))
{
SetBit(144); // yes they are, enable the amplifiers
SetBit(145);
SetBit(146);

}
else
{
ClearBit(144); // no at least one is disabled, disable the amplifiers
ClearBit(145);
ClearBit(146);

}
}
}


Thanks
Mateusz

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

Re: KFLOP STOP and logic outputs to control amplifiers

Post by TomKerekes » Fri Jun 14, 2019 3:57 am

Hi Mateusz,

You might put that in your forever loop in your Init Program in Thread #1 which should not stop.
Regards,

Tom Kerekes
Dynomotion, Inc.

Mateusz
Posts: 31
Joined: Thu Jun 06, 2019 8:36 pm

Re: KFLOP STOP and logic outputs to control amplifiers

Post by Mateusz » Fri Jun 14, 2019 8:30 pm

Works - of course
silly question....I've been fixed to much doing Initialisation on thread 1.....https://dynomotion.com/Help/Multitasking.htm

Post Reply