3 Adding and Configuring MPLAB Harmony Components

To add and configure the MPLAB Harmony components using the MCC, follow these steps:

  1. In the MCC window, under Device Resources, click and expand Harmony > Peripherals > ADC, and then select ADC0.
    Figure 3-1. Selecting ADC Module
  2. To configure ADC0 module, click Project Graph, and then select ADC0 from the left navigation pane.
  3. In the Configuration Options property page, click and expand ADC0 and then select required options as shown below:
    Figure 3-2. ADC0 Configuration
  4. Under Device Resources, click and expand Harmony > Peripherals > SERCOM, and then select SERCOM1.
    Figure 3-3. SERCOM1 Module
  5. Right-click on the SERCOM1 UART, and then select Consumers > STDIO (stdio).
    Figure 3-4. Adding STDIO Module in SERCOM1
  6. To configure the SERCOM1 module, click Project Graph and then select SERCOM1 Peripheral Library UART.
  7. In the Configuration Options property page, click and expand SERCOM1 and then configure as shown below:
    Figure 3-5. SERCOM1 Configuration
  8. Under Device Resources, click and expand Harmony > Peripherals > TC, and then select TC0.
    Figure 3-6. TC0 Module
  9. To configure TC0, select TC0 Peripheral Library TMR, and in the right Configuration Options property page select options as shown below:
    Figure 3-7. Configuration of TC0 Module
  10. From the Plugins drop-down list, select Event Configurator.
    Figure 3-8. Event Configurator
  11. To configure Event Configurator, follow these instructions:
    1. Select Add Channel under Channel Configuration, and then set it up as illustrated.
    2. Select Add User under User Configuration, and then configure it as shown in the following figure.
      Figure 3-9. Configuration of Event Configurator
  12. From the Plugins drop-down list, select DMA Configuration.
    Figure 3-10.  DMA Configuration
  13. To configure the DMA, follow these steps:
    1. Select Add Channel under the Active Channels List, and then select the trigger as ADC0_RESRDY.
    2. Configure DMA Channel 0 Settings as shown in the following figure.
      Figure 3-11. Configuration of DMA
  14. From the Plugins drop-down list, select Pin Configuration, and then click Pin Settings.
    Figure 3-12. Pin Configuration
  15. From the Order menu, select Ports.
    Figure 3-13. Selecting Ports from Order Menu
  16. Configure pins as shown in the following figure.
    Figure 3-14. Configuration of Pins
  17. Click Resource Management [MCC], and then click Generate to generate the code.
    Figure 3-15. Generate the Project