Demonstrating 8-bit I2C Controller Read, Step 8: Configure ATmega4809 Resources with MCC

Last modified by Microchip on 2023/11/09 08:54

Launch MPLAB® Code Configurator (MCC)

Open MCC by clicking the MCC logo in the MPLAB X IDE toolbar.

image-20230327100131-1.png ​     

Select MCC Classic from MCC Content Manager Wizard.

Select MCC Classic

Click Finish since no additional components are needed.

MCC Content Manager Wizard Finish

Back to top


Configure System Module

Now you can start configuring the settings for the ATmega4809.

 Click System Module in the upper left window.

Select System Module

Verify settings match the figure:

Configure System Module

Back to top


Configure I2C

Now we will add the Core Independent Peripherals (CIPs) needed for the project and configure them for the ATmega4809.

In the Device Resources window, open the Foundation Services folder and add I2C by clicking the + icon for I2CSIMPLE.

Add I2CSIMPLE

Information

Note: The TWIO library will be automatically added to the Peripherals Folder since the I2C function is supported by the Two-Wire Interface peripheral.

Select TWIO in the Project Resources window.
Select TWIO
Verify TWIO configuration window settings match the following:
Configure TWIO

Back to top


Configure USART

Add USART3 by opening the USART folder in Device Resources window and clicking the + icon for USART3.

Add USART3

Select USART3 in the Project Resources window.

Select USART3

Verify USART3 settings in its configuration window:

Configure USART3

Back to top


Configure GPIO

Select Pin Manager: Grid View in the bottom right window. Click each of the following pins to create a green lock as either an input or output:

  • TWIO: SCL to RA3
  • TWIO: SDA to RA2
  • USART3: RXD to RB1
  • USART3: TXD to RB0

Configure GPIO

Back to top


Generate MCC Code

Press the Generate button.

Generate button||data-xwiki-image-style-alignment=

Verify the MCC code generation is successful.

MCC Code Generation Success

Back to top


Update main.c

Click on the Projects tab, locate the previous PIC18F47Q10 project and double-click on main.c in the to open it.

Open main.c

Select all the contents of the main.c file with CTRL + A and copy it using CTRL + C.

Open the ATmega4809 project’s main.c by double-clicking its main.c file. Select all of the contents of the main.c file with CTRL + A and paste using CTRL + V.

Open main.c

Save the updated ATmega4809 project’s main.c file using CTRL + S.

Back to top