I hope you are doing well.
I'm trying to figure out how to make the code "DoPCFloat(PC_COMM_SET_Z, 1.25)" work within the M6 tool change routine. My ultimate goal is to measure the tool and assign a new Z value immediately after a tool change. However, it seems that this DoPCFloat is ignored when placed in M6 (below). Interestingly, when I run the exact same code from a user-defined button, the new Z value is applied correctly. I’d be very grateful if anyone could guide me through how to get this working properly within the M6 routine.
Code: Select all
#include "KMotionDef.h"
#include "PC-DSP.h" // already in KMotionDef.h?
#define TMP 10
#include "KflopToKMotionCNCFunctions.c"
float NewZZero;
int main()
{
NewZZero = 1.25;
int slot = persist.UserData[9]; // value stored is an int
int id = persist.UserData[9+1]; // value stored is an int
DoPCFloat(PC_COMM_SET_Z, NewZZero);
printf("Tool Set to slot %d id %d\n",slot,id); // print the slot and id
return 0;
}