The present disclosure is directed to systems and methods for operating anelectromechanical surgical system. The electromechanical surgical systemincludes a hand-heldsurgical instrument including an instrument housing defining a connectingportion for selectivelyconnecting with a shaft assembly. The system also includes an end effectorconfigured toperform at least one function. The shaft assembly is arranged for selectivelyinterconnecting theend effector and the hand-held surgical instrument. The shaft assemblyincludes a drive member,a flag member configured to translate axially along the drive member, and asensor disposedabout the drive member. The sensor provides a signal indicating that the endeffector hasreached an end stop when the flag member contacts that sensor.