Skip to content

The TIMER Toggle LED example, of the MCC Melody Timer Example Component, is used in the Callbacks implementation. The LED on the PIC18F57Q43 Curiosity Nano is toggled, as well as a Debug IO, which can be used to verify the 100 ms period.

License

Notifications You must be signed in to change notification settings

microchip-pic-avr-examples/pic18f57q43-timer-toggle-led-callbacks-mcc

Repository files navigation

MCHP

Video Building This Example

Video Building this Example

Video: Introducing MCC Melody Example Components (while building the Polled version of this example).

MCC Melody Timer Toggle LED Example - Callbacks Implementation (PIC18F57Q43)

The TIMER Toggle LED example, of the MCC Melody Timer Example Component is used in the Callbacks implementation. The LED on the PIC18F57Q43 Curiosity Nano is toggled, as well as a Debug I/O, which can be used to verify the 100 ms period.

MCC Melody Example Components

Example Components are tightly integrated learning material directly into MCC. This allows users to conveniently place configuration instructions side-by-side with the components they are configuring. For more information, refer to the MCC Melody Example Components Introduction.

MCC Melody Example Components

Complete projects specific to a board and microcontroller are available in MPLAB® Discover or GitHub. However, the current project could be recreated on a range of supported microcontrollers by following the steps in the example component.

For more information on example components and differences between example and implementation, see MCC Melody Example Components - The Basics.

Example Components are related to MCC Melody Design Patterns for Control Flow, which shows different standard ways to organize main.c and other application-level files, such as Polling, Interrupt and Callback, or State Machine Design Patterns. Users might be familiar with each of these patterns, but:

  • What support does MCC Melody provide for each?
  • What are the recommended ways of building on the MCC Melody generated code? 

Software Used

  • MPLAB® X IDE 6.20.0 or newer (MPLAB® X IDE 6.20)

  • MPLAB® XC8 2.46.0 or newer (MPLAB® XC8 2.46)

  • MCC Plug-in Version 5.5.1 or newer (Tools > Plugins > Installed, search: "MCC")

  • Timer Example Component 1.0.0 or newer

  • MCC Core 5.7.1 or newer

  • MCC Melody Core 2.7.1 or newer (Communicates with the MCC core, providing views and other functionality for MCC Melody)

MCC Core Version

Hardware Used

  • PIC18F57Q43 Curiosity Nano (DM164150)
  • Curiosity Nano Explorer (EV58G97A) - Not used in this example, but used further in the series.

Setup

All instructions required to recreate this example are listed below under Configuration Instructions.

TIMER Toggle LED, Polled Implementation

Once you have loaded the project in MPLAB X IDE, you will also be able to find more information from Tooltips and links next to the instructions Tooltip and link.

Tooltips and context help

Operation

The image below shows the TIMER Toggle LED example running. The period of 100 ms is verified using Debug GPIO on the MPLAB® Data Visualizer. A PIC18F57Q43 Curiosity Nano is used.

Note: Achieve the same functionality by adding the Timer Example component to a new or existing MCC Melody project, for one of the supported microcontrollers.

Running the Timer Toogle LED example

Two vertical cursors are added to verify the timer frequency. See the configuration instructions below.

  1. Click the Data Visualizer icon icon to open the MPLAB Data Visualizer.
  2. Under Debug GPIO, click the Add to time plot icon icon, to add to the time plot.
  3. Click the Data Visualizer Zoom in icon icon a few times to zoom in on the Time Plot.
  4. Click the Data Visualizer Vertical Cursor icon icon, a couple of times, to add two vertical cursors. Change the cursor positions by dragging them using the mouse to measure the timer period.

DataVisualizer config Timer Toggle LED

A logic analyzer can be used instead of Debug GPIO on the MPLAB® Data Visualizer.

Summary

For more example components, open the stand-alone Content Manager CM_icon in MCC .

Standalone_CM

About

The TIMER Toggle LED example, of the MCC Melody Timer Example Component, is used in the Callbacks implementation. The LED on the PIC18F57Q43 Curiosity Nano is toggled, as well as a Debug IO, which can be used to verify the 100 ms period.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published