A surgical instrument comprising: a handle assembly ; a jaw assembly comprising a staple cartridge containing a plurality of staples and an anvil to form the plurality of staples upon firing; a drive assembly for actuating the jaw assembly, the drive assembly being at least partially located within the handle assembly; a motor disposed within the handle assembly and operatively coupled to the drive assembly; and a controller operatively coupled to the motor for measuring a current draw of the motor to obtain a plurality of samples of the current draw; calculating a plurality of rate of change values based on the plurality of samples of the current draw; the controller including a condition-of-interest counter for counting the number of samples during which the rate of change of the motor current falls within a first range of rate of change values to determine whether operation of the motor has reached a mechanical limit based on a portion of the plurality of rate of change values being within the first range of rate of change values; and the controller including a stability counter for counting the number of samples during which the rate of change of the motor current falls within a second range of rate of change values to determine whether the current draw is stable based on a portion of the plurality of rate of change values being within the second range of rate of change values indicating normal operation of the motor, wherein when the controller determines that the mechanical limit has been reached, the supply of current to the motor is terminated to prevent further operation of the instrument. a handle assembly ; a jaw assembly comprising a staple cartridge containing a plurality of staples and an anvil to form the plurality of staples upon firing; a drive assembly for actuating the jaw assembly, the drive assembly being at least partially located within the handle assembly; a motor disposed within the handle assembly and operatively coupled to the drive assembly; and a controller operatively coupled to the motor for measuring a current draw of the motor to obtain a plurality of samples of the current draw; calculating a plurality of rate of change values based on the plurality of samples of the current draw; the controller including a condition-of-interest counter for counting the number of samples during which the rate of change of the motor current falls within a first range of rate of change values to determine whether operation of the motor has reached a mechanical limit based on a portion of the plurality of rate of change values being within the first range of rate of change values; and the controller including a stability counter for counting the number of samples during which the rate of change of the motor current falls within a second range of rate of change values to determine whether the current draw is stable based on a portion of the plurality of rate of change values being within the second range of rate of change values indicating normal operation of the motor, wherein when the controller determines that the mechanical limit has been reached, the supply of current to the motor is terminated to prevent further operation of the instrument. <EOS>