Skip to content

LED chaser increments binary on 6 LEDs every 100 ms. When all on, toggles 8 LEDs every sec. Polled with Delay driver, shows hex/binary of I/O expander pins via UART printf.

License

Notifications You must be signed in to change notification settings

microchip-pic-avr-examples/avr128db48-i2c-io-expander1-leds-polled-printf

Repository files navigation

Microchip Technologies Inc.

AVR128DB48 I2C_Host Example Component for CNano Explorer: I/O Expander 1 LEDs (Polled, Printf)

The I2C Host IO Expander 1 - LEDs Example, of the MCC Melody I2C Example Component (for the Curiosity Nano Explorer), is used here in the Polled implementation, with the Printf visualization.

alt text

The example implements an LED chaser, incrementing the binary number on the lower six LEDs every 100 ms. Once the six active-low LEDs are all on, the pattern changes to toggle all eight LEDs every second.

The polled implementation simply uses a delay, first of 100 ms then the delay period is changed to 1s once the LED chaser is finished. The hex and binary values of the I/O expander pins are displayed as a printf message over the Universal Asynchronous Receiver and Transmitter (UART).

Operation

When running the application using the MPLAB® Data Visualizer, something similar to the following should display:

alt text Note: the delta 103 ms in the B and the 1.21 s in the C columns, respectively of the time plot. The difference from 100 ms, is simply due to the positioning of the cursor.

Setup

The image below 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.

alt text alt text

MCC Melody Example Components

Example Components are a tight integration of learning material directly into MCC. This allows 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.

Related Documentation

Software Used

  • 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 CM_icon to verify the MCC Core and MCC Melody Core versions.

alt text

Hardware Used

About

LED chaser increments binary on 6 LEDs every 100 ms. When all on, toggles 8 LEDs every sec. Polled with Delay driver, shows hex/binary of I/O expander pins via UART printf.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •