Sticking with the PIC idea couldnt you just have limit switches at the end of each side? you could even ditch the cnc bit and just have a mechanical advance at the end of each travel, simple