need to read Persist Array value from c# program

Moderators: TomKerekes, dynomotion

Post Reply
cadline
Posts: 5
Joined: Sat Mar 31, 2018 3:26 pm

need to read Persist Array value from c# program

Post by cadline » Thu Dec 03, 2020 11:19 pm

Dear Tom,
i write a c program running on kflop ,it fill some Persist Array data and i need to read it from a c# program running on windows.
tha code is a part of your example program :
---------------------------------------------------------------
if (Connected && KM.WaitToken(100) == KMOTION_TOKEN.KMOTION_LOCKED)
{
KM_MainStatus MainStatus;

try
{
MainStatus = KM.GetStatus(false); // we already have a lock
KM.ReleaseToken();
XPos.Text = String.Format("{0:F1}", MainStatus.Destination[0]);
YPos.Text = String.Format("{0:F1}", MainStatus.Destination[1]);
// Diametro.Text = string.Format("GetPersistDec11 {0}", index); <-- i'm not able to write the rigth code,"Diametro" is declared in the code.
}
catch (DMException ex) // in case disconnect in the middle of reading status
{
KM.ReleaseToken();
MessageBox.Show(ex.InnerException.Message);
}
}
else
{
Connected = false;
}

thank you very much
Tiziano F.

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

Re: need to read Persist Array value from c# program

Post by TomKerekes » Thu Dec 03, 2020 11:49 pm

See here for how to read an integer persist variable from KFLOP. As in:

Code: Select all

            int D = KM.GetUserData(11);  // Get persist variable 11
HTH
Regards,

Tom Kerekes
Dynomotion, Inc.

cadline
Posts: 5
Joined: Sat Mar 31, 2018 3:26 pm

Re: need to read Persist Array value from c# program

Post by cadline » Fri Dec 04, 2020 9:07 am

Thank you Tom, have a nice day,
Tiziano

Post Reply