To make sure iam understanding this correctly , below is the 2 parts of my original M6 tool change code that i believe is all that needs changed.
First step of my original M6 tool change....
Does this part need to know that each pocket is 1682.692307692308 counts incrementally, so step 9 of program knows where to rotate to?
Code:
// 1. Determine how many pockets to rotate
int pockets = persist.UserData[6] - persist.UserData[157]; // pockets = requested tool - current tool
if (pockets == 0)
return 0; // No toolchange needed, End
if (pockets >= 8)
pockets = -16 + pockets; // If more then halfway CW, reverse
if (pockets <= -8)
pockets = 16 + pockets; // If more then halfway CCW, reverse
persist.UserData[161] = 1; // Toolchanger active disable feedhold button
ResumeCoordinatedMotion(); // Clear feedhold
// 2. Turn off Flood Coolant if left on
And part that tells which way to rotate and how many pockets to selected pocket.
Code:
// 9. Rotate Carousel
while (pockets >= 1) // Rotate Turret CW whatever number of pockets
{
SetBit(49); // TC Carousel Motor On CW
while (!ReadBit(1033))
WaitNextTimeSlice(); // Wait for CarouselMotorProxSensor
Delay_sec(.4);
ClearBit(49); // TC_Carousel CW Motor Off
pockets = pockets - 1;
}
while (pockets <= -1) // Rotate Turret CCW whatever number of pockets
{
SetBit(50); // TC Carousel Motor On CCW
while (!ReadBit(1033))
WaitNextTimeSlice(); // Wait for CarouselMotorProxSensor
Delay_sec(.4);
ClearBit(50); // TC_Carousel CCW Motor Off
pockets = pockets + 1;
}
// 10. Move Tool Changer UP