Page 1 of 1
Set different programs to different threads
Posted: Sat Apr 26, 2025 7:48 pm
by mnova_user
Can not see a way to tell which function or program is saved on thread n, I have seen commands to check if thread is running,stop it,etc but not able to guess how I setup the code on any thread.
I have a c function to config the channels and another to read data in a loop, works ok are just simple examples but when I reboot the board configuration is lost.
Thanks
Re: Set different programs to different threads
Posted: Sat Apr 26, 2025 7:57 pm
by TomKerekes
We don't have a way to upload the binary code from a Thread's memory and re-create the C Code that created it. Its up to you to keep track of what was placed into a Thread last.
Normally a PC is in the system and it is used to Compile/Download/Execute any program when you want to run it. That way nothing needs to be saved in KFLOP/Kogna or remembered.
To remove anything Flashed into KFLOP/Kogna and return it to a virgin state re-Flash New Version.
HTH
Re: Set different programs to different threads
Posted: Sun Apr 27, 2025 9:50 am
by mnova_user
I think I didn´t explained properly.
Say I have two functions in C (f1 and f2) , and want f1 to run on thread 1 and f2 to run on thread 2,
How can be done?
If you can run programs on different threads must be a way to assing the code to run on each thread in some way.
Re: Set different programs to different threads
Posted: Sun Apr 27, 2025 3:38 pm
by TomKerekes
KFLOP/Kogna uses a simple method of one Program per Thread. You cannot run functions as threads.
You might read
this.
Re: Set different programs to different threads
Posted: Sun Apr 27, 2025 5:31 pm
by mnova_user
Tom,
I was writing a very long answer with the same question as didn´t see the way, and suddently I saw the Thread options on the C program dialog, below on the left....
It was invisible for me until now....
Now is clear, let me try it.
Thanks
Re: Set different programs to different threads
Posted: Sun Apr 27, 2025 5:51 pm
by mnova_user
I hope this is the last question for a while...
Now I load the config on thread1 as stated, but on Axis never get the axis enabled (in KMotionCNC is the same) , rest of config seems ok, if I press Enable on the Axis dialog works Ok, but as ssoon as I press reboot or switch off - on Kflop the axis gets deisabled again.
I use this:
EnableAxisDest(4,0);
EnableAxisDest(5,0);
EnableAxisDest(6,0);
EnableAxisDest(7,0);
And probably is working as the position counters are reset, but never enable the axis.
Is this the default behaviour?
How can I change the status to enabled from a program?
Re: Set different programs to different threads
Posted: Sun Apr 27, 2025 11:34 pm
by TomKerekes
It not clear what you are doing. Its not clear what you mean by "load the config on thread1".
The C Program needs to be Compiled/Downloaded/Executed for a C Program to do anything such as Enable an Axis.
After a Power Loss or reboot the C Program will need to be Compiled/Downloaded/Executed again.
Not sure why you are using Axes 4-7 rather than 0-3. You can, but it is just not logical.
You might read
Initialization C Program.
Also
Setting Parameters.
please Post your entire initialization C Program.
Re: Set different programs to different threads
Posted: Mon Apr 28, 2025 7:55 am
by mnova_user
Hi Tom,
we use the channel 4-7 because we need to use the JP5.
There was a piece that didn't fit, after finding the ini.c settings in Kmotioncnc, everything fits and now is clear for me.
Thanks!!
Re: Set different programs to different threads
Posted: Mon Apr 28, 2025 1:37 pm
by TomKerekes
It’s not necessary to use Axis #4 to use Step/Dir Generator Output #4.
You might read
this.