4 Running the Examples

Examples are available for each diagnostic test. Users can generate these examples if the options are enabled in the user interface.

  1. In the MCC window, navigate to the IEC60730 Class B Diagnostic Library module and enable a diagnostic test (e.g., CPU Program Counter).
  2. Switch to the CPU tab, and enable the Generate Example box of the Program Counter test (see Figure 4-1).
    Figure 4-1. Enabling the Program Counter Test Example
  3. For displaying the test example output, select a USART under Peripherals in the Device Resources panel.
  4. Enable Printf support for AVR devices, or Redirect STDIO to USART for PIC® devices. Configure the other options to match the preferred serial terminal settings (see Figure 4-2).
    Figure 4-2. Configuring the USART in ATtiny3217
  5. Click the Generate button.
  6. Include the header mcc_generated_files/diag_common/examples/diag_common_example.h in main.c. This header contains all the generated example functions.
  7. Call the example function DIAG_CPU_ProgramCounter_Example() in main() (see Figure 4-3).
    Figure 4-3. Adding the Test Example to main.c
  8. Connect a board with the selected device to the PC (e.g., an ATtiny3217 Curiosity Nano).
  9. Build and program the board.
  10. Open and configure a serial terminal to view the example output (see Figure 4-4).
    Figure 4-4. Program Counter Test Output in the Serial Terminal