4 Enable/Disable Code Coverage

By default, MPLAB Code Coverage is disabled. To enable code coverage, complete the following steps:

  1. Right click on the name of your project in the Projects window and select “Properties.”
  2. Under “Categories,” find the project compiler, i.e., XCnn, where nn is either 8, 16 or 32.
  3. Click on the “Code Coverage” under the compiler (see figure).
  4. Select “Code Coverage Instrumentation.” Selections differ for each MPLAB XC compiler. See the table below.
Table 4-1. Enable Code Coverage Options by Compiler
MPLAB XC C CompilerEnable OptionsDescription
XC8DisableDisable code coverage.
EnableEnable code coverage.
XC16DisableDisable code coverage.
Enable Near memoryUse Near RAM space for code coverage instrumentation (recommended). If there is a link error, then select Far.
Enable Far memoryUse Far RAM space for code coverage instrumentation.
XC32DisableDisable code coverage.
EnableEnable code coverage.
Figure 4-1. Code Coverage Options - MPLAB XC16 Example