If it is a pre-2002 (or somewhere around there) machine you probably have a faulty microswitch.
If it is a later model machine you probably have a chip stuck to the proximity sensor.
In both cases you need you need to take the covers off to find the microswitch or proxomity sensor(s). There will probably be two; one is the turret position #1 sensor the other is the one that counts tool positions.
If it is a microswitch try my favorite remedy...hit it a few sharp raps with a plastic hammer to see if you can knock the contacts free inside free; it does work, honest . (Sometimes)
If it is a proximity sensor with a chip on it that will be obvious and you just clean it.