Open the Stopwatch tool window by selecting Window->Debugging->Stopwatch on the MPLAB® X task bar. Using the source code window, generate two break points—one on line 19 and the other on line 20, as shown in Fig. 1. Next, select the properties icon on the top right of the Stopwatch window. (This icon is a hammer and a wrench.)
On the Stopwatch properties window, the two dropdown boxes on the right allow you to select the line of code where the Stopwatch tool will be started and the line of code where the stop watch will be stopped. Fig. 2 shows the results of selecting line 19 to start the stopwatch and line 20 to stop the Stopwatch tool. After selecting the start and stop conditions, select the OK box. The MPLAB screen will look like Fig. 1 once more. Select the Continue control until the execution stops at line 20. The processor cycle count is displayed in the Stopwatch window as shown in Fig. 3.