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.
- In the MCC window, navigate to the IEC60730 Class B Diagnostic Library module and enable a diagnostic test (e.g., CPU Program Counter).
- Switch to the CPU tab, and enable the Generate Example box of the Program Counter test (see Figure 4-1).
- For displaying the test example output, select a USART under Peripherals in the Device Resources panel.
- 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).
- Click the Generate button.
- Include the header
mcc_generated_files/diag_common/examples/diag_common_example.h
inmain.c
. This header contains all the generated example functions. - Call the example function
DIAG_CPU_ProgramCounter_Example()
inmain()
(see Figure 4-3). - Connect a board with the selected device to the PC (e.g., an ATtiny3217 Curiosity Nano).
- Build and program the board.
- Open and configure a serial terminal to view the example output (see Figure 4-4).