Hello Everyone,
I would like to add a cycle counter to the KMotionCNC screen. Ideally it would have a zero reset button and a display to show cycles run since last reset.
Thanks for any and all suggestions,
David.
Cycle Counter
Moderators: TomKerekes, dynomotion
- TomKerekes
- Posts: 2676
- Joined: Mon Dec 04, 2017 1:49 am
Re: Cycle Counter
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
-
- Posts: 6
- Joined: Sat Jul 28, 2018 1:09 am
Re: Cycle Counter
Hi Tom,
Yes we are using the KMotion Screen Editor.
Thanks,
David.
Yes we are using the KMotion Screen Editor.
Thanks,
David.
- TomKerekes
- Posts: 2676
- Joined: Mon Dec 04, 2017 1:49 am
Re: Cycle Counter
Hi David,
You might add a DROLabel to your screen such as shown here in red.
Configure it to monitor Var 162 for a string to display as shown here:
Now create a C Program to increment a persist Variable Counter and display it on the screen. We use Var 50 for the counter.
Another C Program to Clear the count
Then call the Count Program when you want it to increment. For example you might have M30 (end of Job do a count)
You might also add a User Button that executes the ClearCount.c Program to Clear the counter
HTH
You might add a DROLabel to your screen such as shown here in red.
Configure it to monitor Var 162 for a string to display as shown here:
Now create a C Program to increment a persist Variable Counter and display it on the screen. We use Var 50 for the counter.
Code: Select all
#include "KMotionDef.h"
#define TMP 10 // which spare persist to use to transfer data
#include "KflopToKMotionCNCFunctions.c"
#define COUNT_VAR 50 // declare what Variable to use as a counter
void main()
{
char s[80];
persist.UserData[COUNT_VAR]++; // count
// Now Format as string
sprintf(s,"%d",persist.UserData[COUNT_VAR]);
// Put it onto the Screen
DROLabel(1000, 162, s);
}
Another C Program to Clear the count
Code: Select all
#include "KMotionDef.h"
#define TMP 10 // which spare persist to use to transfer data
#include "KflopToKMotionCNCFunctions.c"
#define COUNT_VAR 50 // declare what Variable to use as a counter
void main()
{
char s[80];
persist.UserData[COUNT_VAR]=0; // cleat count
// Now Format as string
sprintf(s,"%d",persist.UserData[COUNT_VAR]);
// Put it onto the Screen
DROLabel(1000, 162, s);
}
Then call the Count Program when you want it to increment. For example you might have M30 (end of Job do a count)
You might also add a User Button that executes the ClearCount.c Program to Clear the counter
HTH
- Attachments
-
- ClearCount.c
- (447 Bytes) Downloaded 355 times
-
- Count.c
- (441 Bytes) Downloaded 340 times
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
-
- Posts: 6
- Joined: Sat Jul 28, 2018 1:09 am
Re: Cycle Counter
Hi Tom,
Thanks very much for your guidance. I will build one tomorrow when I have access to one of our machines.
That was a BIG help!
Regards,
David.
Thanks very much for your guidance. I will build one tomorrow when I have access to one of our machines.
That was a BIG help!
Regards,
David.
-
- Posts: 6
- Joined: Sat Jul 28, 2018 1:09 am
Re: Cycle Counter
Hello Tom,
Just a quick post to let you know the screen counter is awesome and our customers love it.
Thanks very much for your help with this!
Best regards,
David.
Just a quick post to let you know the screen counter is awesome and our customers love it.
Thanks very much for your help with this!
Best regards,
David.
- TomKerekes
- Posts: 2676
- Joined: Mon Dec 04, 2017 1:49 am
Re: Cycle Counter
Hi David,
Great! Thanks for taking the time to post back.
Great! Thanks for taking the time to post back.
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.