Hi Mike,
The card does not give a value for the Pos0 request and it remains at zero, the Dest0 command seems to work fine.
( No response from Pos1 either)
Your system is likely an open loop system that moves blindly with no position feedback. So the measured "Position" is not used at all in your system. All KFLOP knows is the last commanded destination. If you were to add encoder feedback to your system then the Position value would be meaningful.
I wish to plot the axis position but I am struggling with the Pos0 command.
Polling positions or destinations vs time from the PC/Labview will work but be restricted to the whims of the PC/Windows/USB. This means that you may occasionally miss as much as a second or more of data capture.
A better approach is to use a KFLOP C Program to capture the data into its memory, and then later upload the data to the PC. This method guarantees real-time deterministic data capture (exact 180us increments or multiples thereof). There are some simple examples such as CaptureXYZMotionToFile.c (shown below) that will capture data then upload it to a PC Disk file that you might then plot with Labview.
KFLOP C Programs can be easily invoked by the PC using the .NET interface as shown in the Labview example. Basically one function call to Compile/Download the C Program and another to tell it to Execute.
Code:
#include "KMotionDef.h"
#define N 10000
extern double CS0_TimeExecuted;
main()
{
int i,k;
double X0,Y0,Z0,T0,*p=gather_buffer;
CS0_TimeExecuted=0.0;
while (CS0_TimeExecuted==0.0) ; // wait till we Start
*p++ = 0.0;
X0 = *p++ = ch0->Dest;
Y0 = *p++ = ch1->Dest;
Z0 = *p++ = ch2->Dest;
T0 = Time_sec();
// Capture Data
for (i=0; i<N-1; i++)
{
for (k=0; k<1; k++) WaitNextTimeSlice();
*p++ = Time_sec() - T0;
*p++ = ch0->Dest;
*p++ = ch1->Dest;
*p++ = ch2->Dest;
}
p=gather_buffer;
FILE *f=fopen("C:\\temp\\kflopdata.txt","wt");
for (i=0; i<N; i++)
{
// round times to neaarest servo tick
p[0] = ((int)(p[0]/TIMEBASE + 0.5))*TIMEBASE;
fprintf(f,"%16.9f,%16.3f,%16.3f,%16.3f\n",p[0],p[1],p[2],p[3]);
p += 4;
}
fclose(f);
}