Hi,
I'm trying to find a way to get axis positions in a C program (Capp or Cplc). The GetCoordPos() function takes about 700µs to obtain all the structure information. Is there a faster way instead?
I've tried something in a Capp program as below:
double x, y, aa;
pshm->Ldata.coord = cs_number;
Command("pread");
x = pshm->Ldata.D[6];
y = pshm->Ldata.D[7];
aa = pshm->Ldata.D[9];
and:
double x, y, aa;
char *szdata = (char *)malloc(CHAR_BUF_SIZE*sizeof(unsigned char));
sprintf(szdata,"Ldata.coord = %u", cs_number);
Command(szdata);
Command("pread");
x = pshm->Ldata.D[6];
y = pshm->Ldata.D[7];
aa = pshm->Ldata.D[9];
and:
double x, y, aa;
char *szdata = (char *)malloc(CHAR_BUF_SIZE*sizeof(unsigned char));
sprintf(szdata,"&%u p", cs_number);
x = pshm->Ldata.D[6];
y = pshm->Ldata.D[7];
aa = pshm->Ldata.D[9];
But none of them worked, the results showed always : x=0, y=0, aa=0 with the debugger tool.
Another question, I tried with a script program:
open plc 10
ldata.coord = 9
pread
p100 = D6
p101 = D7
close
But I couldn't really understand the result, as shown attached pictures : "watch window.PNG" and "terminal window.PNG", the responses for "&9p" axes position are not the same from different query command calls.
Do I make some mistakes somewhere?
Thanks in advance for help!