cboswell
Member
Hi
I need some help with my code below, the code moves a label web and stops inbetween the web using a sensor.
My problem is with the stopping at the end of this code.
Fisrt problem was when i stop the drive with the sensor it will then not start again due to the sensor being active .
To overcome this i added a small move at the end to index on to the next label which the covers the sensor and allows me to move again on the next trigger. Something is wrong with this as its not reaching full speed.
What i would like is for the sensor to just stop the motion but then allow the main routine to run again for the next product.
Any help advise would be very appreciated.
OK code*****************************************************
if (LatchTriggered(3))// && LongArrayGetElement(CntrlRun))
{
if(!OutputGetState (5))
OutputSetState(Out5,ON);
if (LatchGetOutput(3) + FloatArrayGetElement(FOffset) - TargetPos[Put-2] >= FloatArrayGetElement(Debounce))
{
TargetPos[Put-1] = LatchGetOutput(3) + FloatArrayGetElement(FOffset);
Put++;
if (Put >= 100)
Put = 1;
}
//if(LongArrayGetElement(CntrlRun))
LatchOnInput(3,ProductSensor,TRUE);
}
if (Put != Get)// && LongArrayGetElement(CntrlRun))
{
if ((EncoderGetPos(2) - TargetPos[Get-1] >= 0) && !CamIsEnabled())
{
CamOpenTable(1,2,5);
CamConstantVelocity(MstrRunDist,MtrRunDist);
CamCloseTable();
CamEnable();
Get++;
if (Get >= 100)
Get = 1;
}
}
************************************************************
Need help with below **************************************
if(InputGetState(LabelSensor))
{ CamDisable();
MoveSetAcc(FloatArrayGetElement(JogAccDec) / SlaveCount); // Set move parameters
MoveSetDec(FloatArrayGetElement(JogAccDec) / SlaveCount);
MoveSetVel(FloatArrayGetElement(JogVel) / SlaveCount);
MoveIncremental(500);
//MoveAbsolute(LatchGetOutput(1) + StopDist); // Move to final position
}
if (!InputGetState(RUN) && AxisIsEnabled())
{
AxisDisable();
}
I need some help with my code below, the code moves a label web and stops inbetween the web using a sensor.
My problem is with the stopping at the end of this code.
Fisrt problem was when i stop the drive with the sensor it will then not start again due to the sensor being active .
To overcome this i added a small move at the end to index on to the next label which the covers the sensor and allows me to move again on the next trigger. Something is wrong with this as its not reaching full speed.
What i would like is for the sensor to just stop the motion but then allow the main routine to run again for the next product.
Any help advise would be very appreciated.
OK code*****************************************************
if (LatchTriggered(3))// && LongArrayGetElement(CntrlRun))
{
if(!OutputGetState (5))
OutputSetState(Out5,ON);
if (LatchGetOutput(3) + FloatArrayGetElement(FOffset) - TargetPos[Put-2] >= FloatArrayGetElement(Debounce))
{
TargetPos[Put-1] = LatchGetOutput(3) + FloatArrayGetElement(FOffset);
Put++;
if (Put >= 100)
Put = 1;
}
//if(LongArrayGetElement(CntrlRun))
LatchOnInput(3,ProductSensor,TRUE);
}
if (Put != Get)// && LongArrayGetElement(CntrlRun))
{
if ((EncoderGetPos(2) - TargetPos[Get-1] >= 0) && !CamIsEnabled())
{
CamOpenTable(1,2,5);
CamConstantVelocity(MstrRunDist,MtrRunDist);
CamCloseTable();
CamEnable();
Get++;
if (Get >= 100)
Get = 1;
}
}
************************************************************
Need help with below **************************************
if(InputGetState(LabelSensor))
{ CamDisable();
MoveSetAcc(FloatArrayGetElement(JogAccDec) / SlaveCount); // Set move parameters
MoveSetDec(FloatArrayGetElement(JogAccDec) / SlaveCount);
MoveSetVel(FloatArrayGetElement(JogVel) / SlaveCount);
MoveIncremental(500);
//MoveAbsolute(LatchGetOutput(1) + StopDist); // Move to final position
}
if (!InputGetState(RUN) && AxisIsEnabled())
{
AxisDisable();
}