Since the encoder may have ticked before you hit this block of code, you may want to do something like this.
Code:
//define a variable outside the loop called 'temp1'
if(temp1==0)
{
temp1=Get_Left_Encoder_Count();
}
static long lec = Get_Left_Encoder_Count() - temp1;
if (lec >= 12)
{
pwm02 = 127; //set it to neutral
}
else
{
pwm02 = p3_y;
}