AVR128DB48 I2C_Host Example Component for CNano Explorer: I/O Expander 2 LEDs and BUTTONs (Callbacks, Printf)
The I2C Host IO Expander 2 - LEDs and Buttons Example, of the MCC Melody I2C Example Component (for the Curiosity Nano Explorer), is used here in the Callbacks implementation with the Printf visualization.
On the Curiosity Nano Explorer, the pins on the I2C I/O Expander 1 are connected to active-low LEDs, while the pins on the I2C I/O Expander 2 are connected to buttons (SW1, SW2 and SW3) as well as the joystick inputs (left, right, up, down, press).
This example configures the I/O Expander 1 pins as outputs set LOW, so the active-low LEDs are initially all turned on. The I/O Expander 2 pins are configured as digital inputs. As a button press or joystick input is detected, the associated LED is turned off. The Curiosity Nano's SW is configured as a reset, turning on all the LEDs again. In Callback mode, pin change interrupts are used on both the SW input pin (IO_Reset), as well as the IO_IOExpander2_IRQ.
When running the application using the MPLAB® Data Visualizer, something similar to the following should display:
Note: However, since the SW pin on the Curiosity Nano is a Debug I/O pin, when pushing the IO_Reset, a toggle is picked up on the Debug I/O pin.
The following image outlines the complete MPLAB Code Configurator (MCC) Melody configuration, including all the selected tasks implemented in this example, as seen in the MCC Melody Builder.

Example Components integrate learning material directly into the MCC. This allows the users to conveniently place the configuration instructions side-by-side to the components they are configuring. For more information, refer to the MCC Melody Example Components introduction.
-
MPLAB® X IDE v6.25 or newer
-
MPLAB® XC8 v3.00 or newer
-
MPLAB® Code Configurator (MCC) Plug-in Version v5.6.2 or newer (Tools>Plugins>Installed, search: "MCC")
-
MPLAB® Data Visualizer Plug-in Version v1.4.1926 or newer (Tools>Plugins>Installed, search: "Data Visualizer")
-
MCC Melody I2C_Host Example Component for the Curiosity Nano Explorer 1.0.0 or newer
-
MCC Core v5.8.2 or newer
-
Single Page Application (SPA) Host v1.0.0 or newer
-
MCC Melody Core v2.9.1 or newer
Open the MCC Content Manager
to verify the MCC Core and MCC Melody Core versions.
- AVR128DB48 Curiosity Nano (EV35L43A)
- Curiosity Nano Explorer (EV58G97A)


