Set different programs to different threads

Moderators: TomKerekes, dynomotion

Post Reply
mnova_user
Posts: 8
Joined: Sun Mar 30, 2025 12:41 pm

Set different programs to different threads

Post by mnova_user » Sat Apr 26, 2025 7:48 pm

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

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

Re: Set different programs to different threads

Post by TomKerekes » Sat Apr 26, 2025 7:57 pm

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

Tom Kerekes
Dynomotion, Inc.

mnova_user
Posts: 8
Joined: Sun Mar 30, 2025 12:41 pm

Re: Set different programs to different threads

Post by mnova_user » Sun Apr 27, 2025 9:50 am

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.

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

Re: Set different programs to different threads

Post by TomKerekes » Sun Apr 27, 2025 3:38 pm

KFLOP/Kogna uses a simple method of one Program per Thread. You cannot run functions as threads.

You might read this.
Regards,

Tom Kerekes
Dynomotion, Inc.

mnova_user
Posts: 8
Joined: Sun Mar 30, 2025 12:41 pm

Re: Set different programs to different threads

Post by mnova_user » Sun Apr 27, 2025 5:31 pm

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

mnova_user
Posts: 8
Joined: Sun Mar 30, 2025 12:41 pm

Re: Set different programs to different threads

Post by mnova_user » Sun Apr 27, 2025 5:51 pm

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?

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

Re: Set different programs to different threads

Post by TomKerekes » Sun Apr 27, 2025 11:34 pm

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

Tom Kerekes
Dynomotion, Inc.

mnova_user
Posts: 8
Joined: Sun Mar 30, 2025 12:41 pm

Re: Set different programs to different threads

Post by mnova_user » Mon Apr 28, 2025 7:55 am

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!!

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

Re: Set different programs to different threads

Post by TomKerekes » Mon Apr 28, 2025 1:37 pm

It’s not necessary to use Axis #4 to use Step/Dir Generator Output #4.

You might read this.
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply