External Command Error

Moderators: TomKerekes, dynomotion

Post Reply
Snyggis
Posts: 14
Joined: Thu May 10, 2018 4:04 am

External Command Error

Post by Snyggis » Thu Jun 07, 2018 5:16 am

Good Evening,

I am getting a strange error that I don't understand while running a C Program. A display window pops up in KMotionCNC which says "Invalid External Command Received". I have attached a screen shot. The only way to make it go away is to reboot the KFlop. I am running 434h.
Error Message.PNG
It occurs when I run the program "Set Z Height.C" - AFTER - I have run the program "4X8 Router Tool Touch.c". It will not occur if I do not run "4X8 Router Tool Touch.c"

If I comment out this line it will not cause the error, but as soon as I remove the comment the error window pops up.
persist.UserData[ZOffset] = *(int *) & Offset; //Save offset as global variable

Does anyone know what I could be doing wrong? Been at it for a while and cant seem to make any sense of it.

Thanks!

Snyggis
You do not have the required permissions to view the files attached to this post.

Snyggis
Posts: 14
Joined: Thu May 10, 2018 4:04 am

Re: External Command Error

Post by Snyggis » Thu Jun 07, 2018 5:19 am

Not sure my attachments went through.
You do not have the required permissions to view the files attached to this post.

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

Re: External Command Error

Post by TomKerekes » Thu Jun 07, 2018 4:21 pm

Hi Snyggis,

You forgot to include your RouterIO.h file. But persist variables 100-107 are used to communicate commands to KMotionCNC so those aren't available for your use when using KMotionCNC. See PC-DSP.h file:

#define PC_COMM_PERSIST 100 // First Persist Variable that is uploaded in status
#define N_PC_COMM_PERSIST 8 // Number of Persist Variables that are uploaded in status

If you set a big value in Variable 100 KMotionCNC will try to interpret it as a command and report it as invalid.

HTH
Regards,

Tom Kerekes
Dynomotion, Inc.

Snyggis
Posts: 14
Joined: Thu May 10, 2018 4:04 am

Re: External Command Error

Post by Snyggis » Thu Jun 07, 2018 10:05 pm

Thanks Tom! That makes sense. In the example program that I copied the header file had the following:

#define TMP 10 // which spare persist to use to transfer data.

I was avoiding global variable 10, I guess that line means something else?

Here are the definitions from the header file, looks like I am using all of the global variables that I should not use.
#define ZOffset 100
#define S1Offset 101
#define S2Offset 102
#define S3Offset 103
#define S4Offset 104

Just change these to 50-54 and we should be good.

Thanks,

Snyggis
You do not have the required permissions to view the files attached to this post.

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

Re: External Command Error

Post by TomKerekes » Fri Jun 08, 2018 9:19 pm

Hi Snyggis,

Correct. The 100-107 variables are used to send commands and parameters to KMotionCNC. The TMP determines where KMotionCNC will place any returned values.

Hope that resolves the problem.
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply