Skip to content

This repository provides an example of bare-metal code for a Wake-Up from Sleep procedure. This example shows how to obtain less power consumption by putting the device in the Sleep mode and waking it up using the IOC, with a button controlling the input pin value.

Notifications You must be signed in to change notification settings

microchip-pic-avr-examples/pic18f47q10-cnano-gpio-wake-up-bare

Repository files navigation

MCHP

PIC18F47Q10 GPIO Wake Up

Objective

The PIC18F47Q10 provides multiple PORT modules.

This example presents how to put the microcontroller in Sleep mode and wake it up using the IOC. When a falling edge is detected on the input pin, the device will wake up. The exit from Sleep mode is signaled using an LED. If the microcontroller wakes up, it will turn the LED on, keep the LED on for 100 ms, and then turn it off. The Sleep mode is used to provide power efficiency.

For this example, the RA0 pin is configured as input with IOC enabled on falling edge and connected to a button, and the RE0 pin is configured as output and connected to an LED.

Related Documentation

Software Used

Hardware Used

Setup

The PIC18F47Q10 Curiosity Nano Development Board is used as the test platform.


The following configurations must be made for this project:

  • Clock:
    • Oscillator Select: HFINTOSC
    • HF Internal Clock: Select 1_MHz
    • Clock Divider: 1
  • Watchdog Timer: disabled
  • Low-voltage Programming: enabled
Pin Configuration
RA0 Digital Input
RE0 (LED0) Output

The RA0 will be connected to the user button using a wire.

Operation

  1. Connect the board to the PC.

  2. Open the pic18f47q10-cnano-gpio-wake-up-bare.X project in MPLAB® X IDE.

  3. Set pic18f47q10-cnano-gpio-wake-up-bare.X project as main project. Right click on the project in the Projects tab and click Set as Main Project:


  1. Select the PIC18F47Q10 Curiosity Nano in the Hardware Tool section of the project settings:
  • Right click on the project and click Properties;
  • Select the PIC18F47Q10 Curiosity Nano (click on the SN) in the Hardware Tool tab and then click OK:


  1. Program the project to the board: right click on the project and click Make and Program Device:


Result:

Demo

Summary

This project showcases how the General Purpose Input/Output pins on the PIC18F47Q10 can be used as inputs and outputs. The device is put in Sleep mode and an interrupt is used to wake it up.

About

This repository provides an example of bare-metal code for a Wake-Up from Sleep procedure. This example shows how to obtain less power consumption by putting the device in the Sleep mode and waking it up using the IOC, with a button controlling the input pin value.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published