double GetUserDataDouble(int i)
{
double d;
((int*)(&d))[0] = persist.UserData[i*2];
((int*)(&d))[1] = persist.UserData[i*2+1];
return d;
}
i and TMP are 10 which specifies where the value is located, not the value of variable 5220
In the above function block the variable 5220 value is stored in the TMP .my question is how the TMP value get accessed with persist.userdata{0] and [21].i*2 = 10*2 = 20, I*2+1 = 10*2+1 = 21. So variable 5220 can be extracted from the pair of persist variables 20 and 21
using above program format but with the variable 5220 in the place of 100 is used which records the all dro value .#include "KMotionDef.h"
#define TMP 10 // which spare persist to use to transfer data
#include "KflopToKMotionCNCFunctions.c"
#define Xaxis 0
#define Yaxis 1
#define Zaxis 2
main()
{
double DROx, DROy, DROz, DROa, DROb, DROc;
GetDROs(&DROx, &DROy, &DROz, &DROa, &DROb, &DROc);
SetUserDataDouble(TMP,DROx);
SetVars(100+Xaxis+1, 1, TMP);
SetUserDataDouble(TMP,DROy);
SetVars(100+Yaxis+1, 1, TMP);
SetUserDataDouble(TMP,DROz);
SetVars(100+Zaxis+1, 1, TMP);
DoPC(PC_COMM_UPDATE_FIXTURE);
}
but is there away to change the variable 100 instead of 5220. i tied but i cant do it