Re: Citizen L16 Spindle index Error
Your code seems fine and because its intermittent, its not a code issue. That would alarm every time in the same spot.
The only times I've seen something similar to this it has been the Main Spindle encoder starting to die. One time this happened to me where the spindle would work fine until you tried to do a synchronized move like tapping or threading, then it would alarm with some spindle alarm. Another case it would not index, tap or thread, but the spindle would work fine for simple turning or drilling.
So my guess is that the encoder on the Main is dying. If its an older machine (which it appears to be based on the code you provided) it's likely that the encoder is starting to go. If you can double check that somehow, try that (you could swap it with another working machine if you have another L16). Otherwise if its not too expensive it'd be worth just replacing the encoder to eliminate that possibility. Thats what it sounds like to me.
Report back with the cause if you fix the problem
CNC Product Manager / Training Consultant