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