Page 1 of 1

UC100 wrapper

PostPosted: Fri Feb 17, 2023 12:32 pm
by valhallaCNC
I can get the UC100.function to work . I can't get the status structure members(ex Idle). What is the format for getting Idle in c# ? It is supposed to be true when motion controller is idle. Any pointers would be great. Thanks

Re: UC100 wrapper

PostPosted: Sat Feb 18, 2023 6:29 am
by cncdrive
You can query the status structure with the Getstatus function and then check the idle struct member boolean value if it is true or false.

Re: UC100 wrapper

PostPosted: Sun Feb 19, 2023 2:23 am
by valhallaCNC
Even with that tip.....I'm having a real mental block with this...Are there any C# people that can make this work ? As you can tell I'm not a C# programming whiz. Thanks in advance Joe

Re: UC100 wrapper

PostPosted: Sun Feb 19, 2023 9:42 pm
by cncdrive
Code: Select all
UC100.Stat UCstat = new UC100.Stat();
UC100.GetStatus(ref UCstat);
if (UCstat.Idle)
{
//Do something
}
else
{
//Do something else
}

Re: UC100 wrapper

PostPosted: Mon Feb 20, 2023 12:03 pm
by valhallaCNC
Thanks .. I was trying to use a pointer, as per one of your older posts in 2017. " int GetStatus(Stat * _Stat) " . There is not much info on any of this.

Re: UC100 wrapper

PostPosted: Mon Feb 20, 2023 2:58 pm
by cncdrive
Yes, it is pointer, but in C# there is no such thing as the classical pointers in C++.
The motion control API is in C++ and this function has a pointer parameter, but in C# this is written with the ref keyword, because this works like that in C#.

You can look into the UCCNC/API folder for the C# wrapper it has all the API function prototypes, so you can see all return values, function names and parameters so then you see the syntaxes.

Re: UC100 wrapper

PostPosted: Tue Feb 21, 2023 12:53 pm
by valhallaCNC
Thanks again very helpful information. Along this same line, all the Stat structure function that I have tested work fine. The exception being Softlimit, It never changes state. Is this related to the soflimit LED 268 issue, I have seen posted. I did post a bug report on its behavior with a MPG also. Thanks

Re: UC100 wrapper

PostPosted: Wed Feb 22, 2023 12:17 am
by cncdrive
Softlimit should wrok fine, but you should setup the softlimits and enable it first to make it work.